-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![feature(const_raw_ptr_to_usize_cast)]
#![feature(const_mut_refs)]
#![feature(raw_ref_macros)]
#![no_std]
static mut X: u32 = 0;
static P: usize = unsafe { core::ptr::raw_mut!(X) as usize };I expected to see this happen: The code either compiles successfully or fails to compile with a reasonable error message
Instead, this happened:
error[E0658]: `&raw mut` is not allowed in statics
--> src/lib.rs:8:28
|
8 | static P: usize = unsafe { core::ptr::raw_mut!(X) as usize };
| ^^^^^^^^^^^^^^^^^^^^^^
|
= 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
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
But the code already includes #![feature(const_mut_refs)].
Meta
rustc --version --verbose:
rustc 1.48.0-nightly (381b445ff 2020-09-29)
ecstatic-morse
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.