rust/tests/ui/consts/const-eval/ptr-to-int-transmute-in-consts-issue-87525.stderr

54 lines
2.5 KiB
Plaintext
Raw Normal View History

warning: pointers cannot be transmuted to integers during const eval
--> $DIR/ptr-to-int-transmute-in-consts-issue-87525.rs:61:9
|
LL | std::mem::transmute(ptr)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: at compile-time, pointers do not have an integer value
= note: avoiding this restriction via `union` or raw pointers leads to compile-time undefined behavior
= help: for more information, see https://doc.rust-lang.org/std/mem/fn.transmute.html
= note: `#[warn(ptr_to_integer_transmute_in_consts)]` on by default
2024-09-18 20:29:31 -05:00
error[E0080]: evaluation of constant value failed
--> $DIR/ptr-to-int-transmute-in-consts-issue-87525.rs:68:26
|
LL | const value: usize = zoom(&a);
| ^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
warning: pointers cannot be transmuted to integers during const eval
--> $DIR/ptr-to-int-transmute-in-consts-issue-87525.rs:3:9
|
LL | std::mem::transmute(ptr)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: at compile-time, pointers do not have an integer value
= note: avoiding this restriction via `union` or raw pointers leads to compile-time undefined behavior
= help: for more information, see https://doc.rust-lang.org/std/mem/fn.transmute.html
warning: pointers cannot be transmuted to integers during const eval
--> $DIR/ptr-to-int-transmute-in-consts-issue-87525.rs:13:13
|
LL | std::mem::transmute(ptr)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: at compile-time, pointers do not have an integer value
= note: avoiding this restriction via `union` or raw pointers leads to compile-time undefined behavior
= help: for more information, see https://doc.rust-lang.org/std/mem/fn.transmute.html
warning: pointers cannot be transmuted to integers during const eval
--> $DIR/ptr-to-int-transmute-in-consts-issue-87525.rs:30:13
|
LL | std::mem::transmute(ptr)
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: at compile-time, pointers do not have an integer value
= note: avoiding this restriction via `union` or raw pointers leads to compile-time undefined behavior
= help: for more information, see https://doc.rust-lang.org/std/mem/fn.transmute.html
error: aborting due to 1 previous error; 4 warnings emitted
2024-09-18 20:29:31 -05:00
For more information about this error, try `rustc --explain E0080`.