forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
108 additions
and
0 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
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 @@ | ||
//@ edition: 2021 | ||
#![feature(mut_dont_reset_binding_mode_2024)] | ||
#![allow(unused)] | ||
#![forbid(dereferencing_mut_binding)] | ||
|
||
struct Foo(u8); | ||
|
||
fn main() { | ||
let Foo(mut a) = &Foo(0); | ||
//~^ ERROR: dereferencing `mut` binding | ||
//~| WARN: this changes meaning in Rust 2024 | ||
a = 42; | ||
|
||
let Foo(mut a) = &mut Foo(0); | ||
//~^ ERROR: dereferencing `mut` binding | ||
//~| WARN: this changes meaning in Rust 2024 | ||
a = 42; | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.stderr
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,35 @@ | ||
error: dereferencing `mut` binding | ||
--> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:9:13 | ||
| | ||
LL | let Foo(mut a) = &Foo(0); | ||
| ^^^^^ `mut` dereferences the type of this binding | ||
| | ||
= warning: this changes meaning in Rust 2024 | ||
= note: for more information, see 123076 | ||
help: this will change in edition 2024 | ||
--> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:9:13 | ||
| | ||
LL | let Foo(mut a) = &Foo(0); | ||
| ^^^^^ | ||
note: the lint level is defined here | ||
--> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:4:11 | ||
| | ||
LL | #![forbid(dereferencing_mut_binding)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: dereferencing `mut` binding | ||
--> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:14:13 | ||
| | ||
LL | let Foo(mut a) = &mut Foo(0); | ||
| ^^^^^ `mut` dereferences the type of this binding | ||
| | ||
= warning: this changes meaning in Rust 2024 | ||
= note: for more information, see 123076 | ||
help: this will change in edition 2024 | ||
--> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:14:13 | ||
| | ||
LL | let Foo(mut a) = &mut Foo(0); | ||
| ^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|