rust/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

226 lines
13 KiB
Plaintext
Raw Normal View History

2021-03-31 04:33:45 -05:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:13:1
|
LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
2021-07-12 17:21:35 -05:00
╾─alloc3──╼ │ ╾──╼
2021-03-31 04:33:45 -05:00
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:17:1
|
LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
2021-07-12 17:21:35 -05:00
╾─alloc7──╼ │ ╾──╼
2021-03-31 04:33:45 -05:00
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:21:1
|
LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
00 00 00 00 │ ....
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:24:1
|
LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
00 00 00 00 │ ....
}
error: any use of this value will cause an error
2022-02-22 17:49:12 -06:00
--> $DIR/ub-ref-ptr.rs:31:1
2021-03-31 04:33:45 -05:00
|
LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2021-03-31 04:33:45 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
2021-03-31 04:33:45 -05:00
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:35:39
2021-03-31 04:33:45 -05:00
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2022-02-13 09:27:59 -06:00
| ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2021-03-31 04:33:45 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
2021-03-31 04:33:45 -05:00
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:35:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2022-02-13 09:27:59 -06:00
| ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:41:86
2021-03-31 04:33:45 -05:00
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
2022-02-13 09:27:59 -06:00
| ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2021-03-31 04:33:45 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:41:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
2022-02-13 09:27:59 -06:00
| ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
2021-03-31 04:33:45 -05:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:47:1
2021-03-31 04:33:45 -05:00
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
39 05 00 00 │ 9...
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:50:1
2021-03-31 04:33:45 -05:00
|
LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
39 05 00 00 │ 9...
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:53:1
2021-03-31 04:33:45 -05:00
|
LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
__ __ __ __ │ ░░░░
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:56:1
2022-02-22 17:49:12 -06:00
|
LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null function pointer
2022-02-22 17:49:12 -06:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
00 00 00 00 │ ....
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:58:1
2021-03-31 04:33:45 -05:00
|
LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value
2021-03-31 04:33:45 -05:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
__ __ __ __ │ ░░░░
}
2022-02-22 17:49:12 -06:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:60:1
2022-02-22 17:49:12 -06:00
|
LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x0000000d, but expected a function pointer
2022-02-22 17:49:12 -06:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
0d 00 00 00 │ ....
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:62:1
2022-02-22 17:49:12 -06:00
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
2022-07-02 19:10:15 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered pointer to alloc41, but expected a function pointer
2022-02-22 17:49:12 -06:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
2022-07-02 19:10:15 -05:00
╾─alloc41─╼ │ ╾──╼
2022-02-22 17:49:12 -06:00
}
error: aborting due to 16 previous errors
2021-03-31 04:33:45 -05:00
For more information about this error, try `rustc --explain E0080`.
2022-06-25 08:31:36 -05:00
Future incompatibility report: Future breakage diagnostic:
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:31:1
|
LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2022-06-25 08:31:36 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
Future breakage diagnostic:
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:35:39
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2022-02-13 09:27:59 -06:00
| ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2022-06-25 08:31:36 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
Future breakage diagnostic:
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:35:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2022-02-13 09:27:59 -06:00
| ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
2022-06-25 08:31:36 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
Future breakage diagnostic:
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:41:86
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
2022-02-13 09:27:59 -06:00
| ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2022-06-25 08:31:36 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
Future breakage diagnostic:
error: any use of this value will cause an error
--> $DIR/ub-ref-ptr.rs:41:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
2022-02-13 09:27:59 -06:00
| ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
2022-06-25 08:31:36 -05:00
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>