mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
handle match scrutinee in closure captures
This commit is contained in:
parent
e8ae2d3976
commit
c5ea2d7adc
8 changed files with 137 additions and 10 deletions
|
@ -182,6 +182,43 @@ fn capture_specific_fields() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_pattern() {
|
||||
size_and_align_expr! {
|
||||
struct X(i64, i32, (u8, i128));
|
||||
let y: X = X(2, 5, (7, 3));
|
||||
move |x: i64| {
|
||||
match y {
|
||||
_ => x,
|
||||
}
|
||||
}
|
||||
}
|
||||
size_and_align_expr! {
|
||||
minicore: copy;
|
||||
stmts: [
|
||||
struct X(i64, i32, (u8, i128));
|
||||
let y: X = X(2, 5, (7, 3));
|
||||
]
|
||||
|x: i64| {
|
||||
match y {
|
||||
X(_a, _b, _c) => x,
|
||||
}
|
||||
}
|
||||
}
|
||||
size_and_align_expr! {
|
||||
minicore: copy;
|
||||
stmts: [
|
||||
struct X(i64, i32, (u8, i128));
|
||||
let y: X = X(2, 5, (7, 3));
|
||||
]
|
||||
|x: i64| {
|
||||
match y {
|
||||
_y => x,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ellipsis_pattern() {
|
||||
size_and_align_expr! {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue