mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
fix stack overflow in is_ty_uninhabited_from
This commit is contained in:
parent
a375ad668c
commit
d5c7ec499a
2 changed files with 59 additions and 5 deletions
|
@ -692,6 +692,41 @@ fn f(inp: (Foo, Foo, Foo, Foo)) {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
// FIXME: We should have tests for `is_ty_uninhabited_from`
|
||||
fn regression_14421() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
pub enum Tree {
|
||||
Node(TreeNode),
|
||||
Leaf(TreeLeaf),
|
||||
}
|
||||
|
||||
struct Box<T>(&T);
|
||||
|
||||
pub struct TreeNode {
|
||||
pub depth: usize,
|
||||
pub children: [Box<Tree>; 8]
|
||||
}
|
||||
|
||||
pub struct TreeLeaf {
|
||||
pub depth: usize,
|
||||
pub data: u8
|
||||
}
|
||||
|
||||
pub fn test() {
|
||||
let mut tree = Tree::Leaf(
|
||||
//^^^^^^^^ 💡 weak: variable does not need to be mutable
|
||||
TreeLeaf {
|
||||
depth: 0,
|
||||
data: 0
|
||||
}
|
||||
);
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fn_traits() {
|
||||
check_diagnostics(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue