]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
Update unsuspicious file list
[rustc.git] / src / test / ui / consts / const-eval / ub-ref-ptr.64bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2 --> $DIR/ub-ref-ptr.rs:13:1
3 |
4 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
5 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
6 |
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.
8 = note: the raw bytes of the constant (size: 8, align: 8) {
9 ╾───────alloc3────────╼ │ ╾──────╼
10 }
11
12 error[E0080]: it is undefined behavior to use this value
13 --> $DIR/ub-ref-ptr.rs:17:1
14 |
15 LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
17 |
18 = 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.
19 = note: the raw bytes of the constant (size: 8, align: 8) {
20 ╾───────alloc7────────╼ │ ╾──────╼
21 }
22
23 error[E0080]: it is undefined behavior to use this value
24 --> $DIR/ub-ref-ptr.rs:21:1
25 |
26 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
27 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
28 |
29 = 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.
30 = note: the raw bytes of the constant (size: 8, align: 8) {
31 00 00 00 00 00 00 00 00 │ ........
32 }
33
34 error[E0080]: it is undefined behavior to use this value
35 --> $DIR/ub-ref-ptr.rs:24:1
36 |
37 LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
38 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
39 |
40 = 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.
41 = note: the raw bytes of the constant (size: 8, align: 8) {
42 00 00 00 00 00 00 00 00 │ ........
43 }
44
45 error[E0080]: evaluation of constant value failed
46 --> $DIR/ub-ref-ptr.rs:31:1
47 |
48 LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
50 |
51 = help: this code performed an operation that depends on the underlying bytes representing a pointer
52 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
53
54 error[E0080]: evaluation of constant value failed
55 --> $DIR/ub-ref-ptr.rs:34:39
56 |
57 LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
58 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
59 |
60 = help: this code performed an operation that depends on the underlying bytes representing a pointer
61 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
62
63 note: erroneous constant used
64 --> $DIR/ub-ref-ptr.rs:34:38
65 |
66 LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68
69 error[E0080]: evaluation of constant value failed
70 --> $DIR/ub-ref-ptr.rs:37:86
71 |
72 LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
73 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
74 |
75 = help: this code performed an operation that depends on the underlying bytes representing a pointer
76 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
77
78 note: erroneous constant used
79 --> $DIR/ub-ref-ptr.rs:37:85
80 |
81 LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
82 | ^^^^^^^^^^^^^^^^^^^^^
83
84 error[E0080]: it is undefined behavior to use this value
85 --> $DIR/ub-ref-ptr.rs:40:1
86 |
87 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
89 |
90 = 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.
91 = note: the raw bytes of the constant (size: 8, align: 8) {
92 39 05 00 00 00 00 00 00 │ 9.......
93 }
94
95 error[E0080]: it is undefined behavior to use this value
96 --> $DIR/ub-ref-ptr.rs:43:1
97 |
98 LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
100 |
101 = 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.
102 = note: the raw bytes of the constant (size: 8, align: 8) {
103 39 05 00 00 00 00 00 00 │ 9.......
104 }
105
106 error[E0080]: evaluation of constant value failed
107 --> $DIR/ub-ref-ptr.rs:46:41
108 |
109 LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
110 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
111
112 error[E0080]: it is undefined behavior to use this value
113 --> $DIR/ub-ref-ptr.rs:50:1
114 |
115 LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
116 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
117 |
118 = 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.
119 = note: the raw bytes of the constant (size: 8, align: 8) {
120 00 00 00 00 00 00 00 00 │ ........
121 }
122
123 error[E0080]: evaluation of constant value failed
124 --> $DIR/ub-ref-ptr.rs:52:38
125 |
126 LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
127 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
128
129 error[E0080]: it is undefined behavior to use this value
130 --> $DIR/ub-ref-ptr.rs:55:1
131 |
132 LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
134 |
135 = 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.
136 = note: the raw bytes of the constant (size: 8, align: 8) {
137 0d 00 00 00 00 00 00 00 │ ........
138 }
139
140 error[E0080]: it is undefined behavior to use this value
141 --> $DIR/ub-ref-ptr.rs:57:1
142 |
143 LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
144 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
145 |
146 = 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.
147 = note: the raw bytes of the constant (size: 8, align: 8) {
148 ╾───────alloc41───────╼ │ ╾──────╼
149 }
150
151 error: aborting due to 14 previous errors
152
153 For more information about this error, try `rustc --explain E0080`.