mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Add a test case to add_missing_match_arms
Although it doesn't panic now, further changes to how we recover from incomplete syntax may cause this assist to panic. To mitigate this a test case has been added.
This commit is contained in:
parent
145a101fe8
commit
622e1a8d88
1 changed files with 31 additions and 0 deletions
|
@ -1944,4 +1944,35 @@ fn main() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
/// See [`discussion`](https://github.com/rust-lang/rust-analyzer/pull/15594#discussion_r1322960614)
|
||||
#[test]
|
||||
fn missing_field_name() {
|
||||
check_assist(
|
||||
add_missing_match_arms,
|
||||
r#"
|
||||
enum A {
|
||||
A,
|
||||
Missing { a: u32, : u32, c: u32 }
|
||||
}
|
||||
|
||||
fn a() {
|
||||
let b = A::A;
|
||||
match b$0 {}
|
||||
}"#,
|
||||
r#"
|
||||
enum A {
|
||||
A,
|
||||
Missing { a: u32, : u32, c: u32 }
|
||||
}
|
||||
|
||||
fn a() {
|
||||
let b = A::A;
|
||||
match b {
|
||||
$0A::A => todo!(),
|
||||
A::Missing { a, u32, c } => todo!(),
|
||||
}
|
||||
}"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue