]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-ref-ptr.stderr
New upstream version 1.52.1+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-ref-ptr.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
6a06907d 2 --> $DIR/ub-ref-ptr.rs:12:1
0bf4aa26
XL
3 |
4LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
74b04a01 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
0bf4aa26 6 |
e1599b0c 7 = 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.
0bf4aa26 8
a1dfa0c6 9error[E0080]: it is undefined behavior to use this value
6a06907d 10 --> $DIR/ub-ref-ptr.rs:16:1
0bf4aa26 11 |
74b04a01
XL
12LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned box (required 2 byte alignment but found 1)
14 |
15 = 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.
16
17error[E0080]: it is undefined behavior to use this value
6a06907d 18 --> $DIR/ub-ref-ptr.rs:20:1
74b04a01 19 |
0bf4aa26 20LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
74b04a01
XL
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a NULL reference
22 |
23 = 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.
24
25error[E0080]: it is undefined behavior to use this value
6a06907d 26 --> $DIR/ub-ref-ptr.rs:23:1
74b04a01
XL
27 |
28LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a NULL box
0bf4aa26 30 |
e1599b0c 31 = 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.
0bf4aa26 32
a1dfa0c6 33error[E0080]: it is undefined behavior to use this value
6a06907d 34 --> $DIR/ub-ref-ptr.rs:29:1
0bf4aa26
XL
35 |
36LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
1b1a35ee 37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc14, but expected initialized plain (non-pointer) bytes
0bf4aa26 38 |
e1599b0c 39 = 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.
0bf4aa26 40
a1dfa0c6 41error[E0080]: it is undefined behavior to use this value
6a06907d 42 --> $DIR/ub-ref-ptr.rs:32:1
0bf4aa26
XL
43 |
44LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
a1dfa0c6 45 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
0bf4aa26 46 |
e1599b0c 47 = 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.
0bf4aa26 48
a1dfa0c6 49error[E0080]: it is undefined behavior to use this value
6a06907d 50 --> $DIR/ub-ref-ptr.rs:35:1
74b04a01
XL
51 |
52LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
54 |
55 = 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.
56
57error[E0080]: it is undefined behavior to use this value
6a06907d 58 --> $DIR/ub-ref-ptr.rs:38:1
0bf4aa26
XL
59 |
60LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
74b04a01
XL
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (created from integer)
62 |
63 = 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.
64
65error[E0080]: it is undefined behavior to use this value
6a06907d 66 --> $DIR/ub-ref-ptr.rs:41:1
74b04a01
XL
67 |
68LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (created from integer)
0bf4aa26 70 |
e1599b0c 71 = 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.
0bf4aa26 72
6a06907d
XL
73error[E0080]: it is undefined behavior to use this value
74 --> $DIR/ub-ref-ptr.rs:44:1
75 |
76LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
77 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
78 |
79 = 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.
80
81error[E0080]: it is undefined behavior to use this value
82 --> $DIR/ub-ref-ptr.rs:46:1
83 |
84LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
85 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a function pointer
86 |
87 = 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.
88
89error: aborting due to 11 previous errors
0bf4aa26
XL
90
91For more information about this error, try `rustc --explain E0080`.