mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 21:04:18 +00:00
Merge pull request #19063 from davidbarsky/davidbarsky/backout-struct-default-fields
internal: backout `hir-*` changes from #19001
This commit is contained in:
commit
bc10a44798
31 changed files with 78 additions and 625 deletions
|
|
@ -846,35 +846,4 @@ pub struct Claims {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_field_values() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
struct F {
|
||||
field1: i32 = 4,
|
||||
field2: bool,
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let _f = F {
|
||||
field2: true,
|
||||
..
|
||||
};
|
||||
|
||||
let _f = F {
|
||||
//^ 💡 error: missing structure fields:
|
||||
//| - field1
|
||||
field2: true,
|
||||
};
|
||||
|
||||
let _f = F {
|
||||
//^ 💡 error: missing structure fields:
|
||||
//| - field2
|
||||
..
|
||||
};
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1232,21 +1232,6 @@ fn f() {
|
|||
let (_, _, _, ..) = (true, 42);
|
||||
// ^^^^^^^^^^^^^ error: expected (bool, i32), found (bool, i32, {unknown})
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diagnostics_inside_field_default_expr() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
struct Foo {
|
||||
foo: i32 = {
|
||||
let x = false;
|
||||
x
|
||||
// ^ error: expected i32, found bool
|
||||
},
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue