You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #116930 - RalfJung:raw-ptr-match, r=<try>
patterns: reject raw pointers that are not just integers
Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not.
Cc `@oli-obk` `@lcnr`
Copy file name to clipboardexpand all lines: compiler/rustc_mir_build/messages.ftl
+1-1
Original file line number
Diff line number
Diff line change
@@ -242,7 +242,7 @@ mir_build_overlapping_range_endpoints = multiple patterns overlap on their endpo
242
242
mir_build_pattern_not_covered = refutable pattern in {$origin}
243
243
.pattern_ty = the matched value is of type `{$pattern_ty}`
244
244
245
-
mir_build_pointer_pattern = 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.
245
+
mir_build_pointer_pattern = function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
246
246
247
247
mir_build_privately_uninhabited = pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
Copy file name to clipboardexpand all lines: tests/ui/consts/const_in_pattern/issue-44333.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
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.
1
+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
2
2
--> $DIR/issue-44333.rs:19:9
3
3
|
4
4
LL | FOO => println!("foo"),
@@ -12,7 +12,7 @@ note: the lint level is defined here
12
12
LL | #![warn(pointer_structural_match)]
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^^
14
14
15
-
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.
15
+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8
+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22
+
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
Copy file name to clipboardexpand all lines: tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
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.
1
+
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
0 commit comments