Talk about unpredictable instead of "not deterministic"
This commit is contained in:
parent
1b1b6eabaa
commit
d486486afd
5 changed files with 8 additions and 8 deletions
|
@ -413,8 +413,8 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
|
||||||
ty::FnPtr(..) | ty::RawPtr(..) => {
|
ty::FnPtr(..) | ty::RawPtr(..) => {
|
||||||
if self.include_lint_checks && !self.saw_const_match_error.get() {
|
if self.include_lint_checks && !self.saw_const_match_error.get() {
|
||||||
self.saw_const_match_error.set(true);
|
self.saw_const_match_error.set(true);
|
||||||
let msg = "function pointers and unsized pointers in patterns do not behave \
|
let msg = "function pointers and unsized pointers in patterns behave \
|
||||||
deterministically. \
|
unpredictably and should not be relied upon. \
|
||||||
See https://github.com/rust-lang/rust/issues/70861 for details.";
|
See https://github.com/rust-lang/rust/issues/70861 for details.";
|
||||||
tcx.struct_span_lint_hir(
|
tcx.struct_span_lint_hir(
|
||||||
lint::builtin::POINTER_STRUCTURAL_MATCH,
|
lint::builtin::POINTER_STRUCTURAL_MATCH,
|
||||||
|
|
|
@ -16,9 +16,9 @@ const BAR: Func = bar;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match test(std::env::consts::ARCH.len()) {
|
match test(std::env::consts::ARCH.len()) {
|
||||||
FOO => println!("foo"), //~ WARN pointers in patterns do not behave deterministically
|
FOO => println!("foo"), //~ WARN pointers in patterns behave unpredictably
|
||||||
//~^ WARN will become a hard error
|
//~^ WARN will become a hard error
|
||||||
BAR => println!("bar"), //~ WARN pointers in patterns do not behave deterministically
|
BAR => println!("bar"), //~ WARN pointers in patterns behave unpredictably
|
||||||
//~^ WARN will become a hard error
|
//~^ WARN will become a hard error
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: function pointers and unsized pointers in patterns do not behave deterministically. See https://github.com/rust-lang/rust/issues/70861 for details.
|
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:19:9
|
||||||
|
|
|
|
||||||
LL | FOO => println!("foo"),
|
LL | FOO => println!("foo"),
|
||||||
|
@ -12,7 +12,7 @@ LL | #![warn(pointer_structural_match)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= 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: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and unsized pointers in patterns do not behave deterministically. See https://github.com/rust-lang/rust/issues/70861 for details.
|
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:21:9
|
||||||
|
|
|
|
||||||
LL | BAR => println!("bar"),
|
LL | BAR => println!("bar"),
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn main() {
|
||||||
let s = B(my_fn);
|
let s = B(my_fn);
|
||||||
match s {
|
match s {
|
||||||
B(TEST) => println!("matched"),
|
B(TEST) => println!("matched"),
|
||||||
//~^ WARN pointers in patterns do not behave deterministically
|
//~^ WARN pointers in patterns behave unpredictably
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
||||||
_ => panic!("didn't match")
|
_ => panic!("didn't match")
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: function pointers and unsized pointers in patterns do not behave deterministically. See https://github.com/rust-lang/rust/issues/70861 for details.
|
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:35:7
|
||||||
|
|
|
|
||||||
LL | B(TEST) => println!("matched"),
|
LL | B(TEST) => println!("matched"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue