mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add mir lower support for tuple destructing assignment
This commit is contained in:
parent
9b636e2326
commit
b96e4f2f4a
2 changed files with 65 additions and 0 deletions
|
@ -1203,6 +1203,27 @@ fn destructing_assignment() {
|
|||
"#,
|
||||
5,
|
||||
);
|
||||
check_number(
|
||||
r#"
|
||||
const GOAL: u8 = {
|
||||
let (mut a, mut b) = (2, 5);
|
||||
(a, b) = (b, a);
|
||||
a * 10 + b
|
||||
};
|
||||
"#,
|
||||
52,
|
||||
);
|
||||
check_number(
|
||||
r#"
|
||||
struct Point { x: i32, y: i32 }
|
||||
const GOAL: i32 = {
|
||||
let mut p = Point { x: 5, y: 6 };
|
||||
(p.x, _) = (p.y, p.x);
|
||||
p.x * 10 + p.y
|
||||
};
|
||||
"#,
|
||||
66,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue