File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
tests/ui/consts/min_const_fn Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,7 @@ const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }
77const unsafe fn bad_const_unsafe_deref_raw_ref ( x : * mut usize ) -> & ' static usize { & * x }
88//~^ dereferencing raw mutable pointers in constant functions
99
10+ const unsafe fn bad_const_unsafe_deref_raw_underscore ( x : * mut usize ) { let _ = * x; }
11+ //~^ dereferencing raw mutable pointers in constant functions
12+
1013fn main ( ) { }
Original file line number Diff line number Diff line change @@ -25,6 +25,15 @@ LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static u
2525 = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
2626 = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
2727
28- error: aborting due to 3 previous errors
28+ error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
29+ --> $DIR/min_const_fn_unsafe_bad.rs:10:80
30+ |
31+ LL | const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; }
32+ | ^^
33+ |
34+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
35+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
36+
37+ error: aborting due to 4 previous errors
2938
3039For more information about this error, try `rustc --explain E0658`.
You can’t perform that action at this time.
0 commit comments