-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn pointer_structural_match forward compat lint into normal lint
This commit removes the pointer_structural_match forward compat lint from the forward compatibility warning mechanism, as there is no concrete plan for removal of matching on function pointers. It also turns the lint from allow-by-default to warn-by-default, as the behaviour might be surprising to users and they should specifically opt into the dangers. As the lint is recognized on older compilers, users can easily allow it after having made the descision on whether they want to keep it in their code or not.
- Loading branch information
Showing
13 changed files
with
22 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details. | ||
--> $DIR/issue-44333.rs:19:9 | ||
--> $DIR/issue-44333.rs:17:9 | ||
| | ||
LL | FOO => println!("foo"), | ||
| ^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861> | ||
note: the lint level is defined here | ||
--> $DIR/issue-44333.rs:3:9 | ||
| | ||
LL | #![warn(pointer_structural_match)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: `#[warn(pointer_structural_match)]` on by default | ||
|
||
warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details. | ||
--> $DIR/issue-44333.rs:21:9 | ||
--> $DIR/issue-44333.rs:18:9 | ||
| | ||
LL | BAR => println!("bar"), | ||
| ^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861> | ||
|
||
warning: 2 warnings emitted | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// run-pass | ||
|
||
#![warn(pointer_structural_match)] | ||
|
||
#![allow(dead_code)] | ||
const C: *const u8 = &0; | ||
|
||
|
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
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
10 changes: 2 additions & 8 deletions
10
tests/ui/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details. | ||
--> $DIR/issue-63479-match-fnptr.rs:35:7 | ||
--> $DIR/issue-63479-match-fnptr.rs:33:7 | ||
| | ||
LL | B(TEST) => println!("matched"), | ||
| ^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861> | ||
note: the lint level is defined here | ||
--> $DIR/issue-63479-match-fnptr.rs:8:9 | ||
| | ||
LL | #![warn(pointer_structural_match)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: `#[warn(pointer_structural_match)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|