forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133093 - est31:let_chains_tests, r=traviscross Let chains tests Filing this as this marks off two of the open issues in rust-lang#132833: * extending the tests for `move-guard-if-let-chain.rs` and `conflicting_bindings.rs` to have chains with multiple let's (one implementation could for example search for the first `let` and then terminate). * An instance where a temporary lives shorter than with nested ifs, breaking compilation: rust-lang#103476. This was fixed in the end by the if let rescoping work. Closes rust-lang#103476
- Loading branch information
Showing
5 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// issue-103476 | ||
//@ compile-flags: -Zlint-mir -Zunstable-options | ||
//@ edition: 2024 | ||
//@ check-pass | ||
|
||
#![feature(let_chains)] | ||
#![allow(irrefutable_let_patterns)] | ||
|
||
struct Pd; | ||
|
||
impl Pd { | ||
fn it(&self) -> It { | ||
todo!() | ||
} | ||
} | ||
|
||
pub struct It<'a>(Box<dyn Tr<'a>>); | ||
|
||
trait Tr<'a> {} | ||
|
||
fn f(m: Option<Pd>) { | ||
if let Some(n) = m && let it = n.it() {}; | ||
} | ||
|
||
fn main() {} |