diff options
| author | dianne <diannes.gm@gmail.com> | 2025-08-13 01:02:13 -0700 |
|---|---|---|
| committer | dianne <diannes.gm@gmail.com> | 2025-08-13 01:38:22 -0700 |
| commit | 8fc3938d9961568dfec38b10506f33fd9bc7c147 (patch) | |
| tree | a6e4f51b31faad2c7ce7b0aef74e524b685c33fa /tests/ui/drop | |
| parent | bbf08d87eb92f618120b6517651588950780b3e4 (diff) | |
| download | rust-8fc3938d9961568dfec38b10506f33fd9bc7c147.tar.gz rust-8fc3938d9961568dfec38b10506f33fd9bc7c147.zip | |
fix scope of `super let` bindings within `if let`
They now use the enclosing temporary scope as their scope, regardless of which `ScopeData` was used to mark it.
Diffstat (limited to 'tests/ui/drop')
| -rw-r--r-- | tests/ui/drop/if-let-super-let.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/ui/drop/if-let-super-let.rs b/tests/ui/drop/if-let-super-let.rs index 0f966e793a3..c6543e6d3dc 100644 --- a/tests/ui/drop/if-let-super-let.rs +++ b/tests/ui/drop/if-let-super-let.rs @@ -25,8 +25,8 @@ fn main() { ); #[cfg(e2024)] ( - if let _ = { super let _x = o.log(2); } { o.push(0) }, - o.push(1), + if let _ = { super let _x = o.log(1); } { o.push(0) }, + o.push(2), ); }); assert_drop_order(0..=2, |o| { @@ -37,15 +37,15 @@ fn main() { ); #[cfg(e2024)] ( - if let true = { super let _x = o.log(2); false } {} else { o.push(0) }, - o.push(1), + if let true = { super let _x = o.log(0); false } {} else { o.push(1) }, + o.push(2), ); }); // `pin!` should behave likewise. assert_drop_order(0..=2, |o| { #[cfg(e2021)] (if let _ = pin!(o.log(2)) { o.push(0) }, o.push(1)); - #[cfg(e2024)] (if let _ = pin!(o.log(2)) { o.push(0) }, o.push(1)); + #[cfg(e2024)] (if let _ = pin!(o.log(1)) { o.push(0) }, o.push(2)); }); assert_drop_order(0..=2, |o| { #[cfg(e2021)] @@ -55,8 +55,8 @@ fn main() { ); #[cfg(e2024)] ( - if let None = Some(pin!(o.log(2))) {} else { o.push(0) }, - o.push(1), + if let None = Some(pin!(o.log(0))) {} else { o.push(1) }, + o.push(2), ); }); @@ -65,15 +65,15 @@ fn main() { // dropped before the first operand's temporary. This is consistent across Editions. assert_drop_order(0..=1, |o| { match () { - _ if let _ = o.log(0) - && let _ = { super let _x = o.log(1); } => {} + _ if let _ = o.log(1) + && let _ = { super let _x = o.log(0); } => {} _ => unreachable!(), } }); assert_drop_order(0..=1, |o| { match () { - _ if let _ = o.log(0) - && let _ = pin!(o.log(1)) => {} + _ if let _ = o.log(1) + && let _ = pin!(o.log(0)) => {} _ => unreachable!(), } }); |
