-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc_hir_typeck
: Account for skipped_ref_pats
in expr_use_visitor
Fixes #125058
- Loading branch information
1 parent
421f7ca
commit fe8f66e
Showing
3 changed files
with
53 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//@ run-pass | ||
//@ edition: 2024 | ||
//@ compile-flags: -Zunstable-options | ||
|
||
#![allow(incomplete_features)] | ||
#![feature(ref_pat_eat_one_layer_2024)] | ||
|
||
struct Foo; | ||
//~^ WARN struct `Foo` is never constructed | ||
|
||
fn main() { | ||
|| { | ||
//~^ WARN unused closure that must be used | ||
if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ||
let _: u32 = x; | ||
} | ||
}; | ||
} |
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,24 @@ | ||
warning: struct `Foo` is never constructed | ||
--> $DIR/skipped-ref-pats-issue-125058.rs:8:8 | ||
| | ||
LL | struct Foo; | ||
| ^^^ | ||
| | ||
= note: `#[warn(dead_code)]` on by default | ||
|
||
warning: unused closure that must be used | ||
--> $DIR/skipped-ref-pats-issue-125058.rs:12:5 | ||
| | ||
LL | / || { | ||
LL | | | ||
LL | | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ||
LL | | let _: u32 = x; | ||
LL | | } | ||
LL | | }; | ||
| |_____^ | ||
| | ||
= note: closures are lazy and do nothing unless called | ||
= note: `#[warn(unused_must_use)]` on by default | ||
|
||
warning: 2 warnings emitted | ||
|