-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)
Description
#![allow(unused)]
fn main() {
let a = [1,2,3];
println!("{:p}", &a); // 0x7ffcbc067704
}
execute this programme in Miri , got the following error:
error[E0080]: constant evaluation error: a raw memory access tried to access part of a pointer value as raw bytes
--> /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/cmp.rs:869:52
|
869 | fn ge(&self, other: &$t) -> bool { (*self) >= (*other) }
| ^^^^^^^^^^^^^^^^^^^ a raw memory access tried to access part of a pointer value as raw bytes
|
...
...
4 | println!("{:p}", &a); // 0x7ffcbc067704
| ^^^^^^^^^^^^^^^^^^^^^
note: inside call to `main`
...
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)