Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
300901b70509a0af2d971aa6f6104300da24212c
rust/tests/ui/consts/const-deref-ptr.rs

8 lines
220 B
Rust
Raw Normal View History

Stabilize `const_raw_ptr_deref` for `*const T` This stabilizes dereferencing immutable raw pointers in const contexts. It does not stabilize `*mut T` dereferencing. This is placed behind the `const_raw_mut_ptr_deref` feature gate.
2021-10-05 04:55:57 -04:00
// Check that you can't dereference invalid raw pointers in constants.
Prevent comparison and dereferencing of raw pointers in constexprs Fixes #25826.
2015-05-28 00:35:56 +03:00
fn main() {
Place unions, pointer casts and pointer derefs behind extra feature gates
2018-07-02 19:00:07 +02:00
static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
Stabilize `const_raw_ptr_deref` for `*const T` This stabilizes dereferencing immutable raw pointers in const contexts. It does not stabilize `*mut T` dereferencing. This is placed behind the `const_raw_mut_ptr_deref` feature gate.
2021-10-05 04:55:57 -04:00
//~^ ERROR could not evaluate static initializer
Prevent comparison and dereferencing of raw pointers in constexprs Fixes #25826.
2015-05-28 00:35:56 +03:00
println!("{}", C);
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 2765ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API