Test let _ = for const_mut_refs.

This commit is contained in:
Camille GILLOT 2023-03-08 14:39:39 +00:00
parent 09dc10c9c2
commit 2eccd52157
2 changed files with 13 additions and 1 deletions

View File

@ -7,4 +7,7 @@ const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x
const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }
//~^ dereferencing raw mutable pointers in constant functions
const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; }
//~^ dereferencing raw mutable pointers in constant functions
fn main() {}

View File

@ -25,6 +25,15 @@ LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static u
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 3 previous errors
error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
--> $DIR/min_const_fn_unsafe_bad.rs:10:80
|
LL | const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; }
| ^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.