File tree 2 files changed +13
-1
lines changed
tests/ui/consts/min_const_fn
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 }
7
7
const unsafe fn bad_const_unsafe_deref_raw_ref ( x : * mut usize ) -> & ' static usize { & * x }
8
8
//~^ dereferencing raw mutable pointers in constant functions
9
9
10
+ const unsafe fn bad_const_unsafe_deref_raw_underscore ( x : * mut usize ) { let _ = * x; }
11
+ //~^ dereferencing raw mutable pointers in constant functions
12
+
10
13
fn 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
25
25
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
26
26
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
27
27
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
29
38
30
39
For more information about this error, try `rustc --explain E0658`.
You can’t perform that action at this time.
0 commit comments