]>
Commit | Line | Data |
---|---|---|
f9f354fc | 1 | error[E0080]: it is undefined behavior to use this value |
cdc7bbd5 | 2 | --> $DIR/const_refers_to_static_cross_crate.rs:12:1 |
f9f354fc XL |
3 | | |
4 | LL | / const SLICE_MUT: &[u8; 1] = { | |
5 | LL | | | |
f9f354fc XL |
6 | LL | | unsafe { &static_cross_crate::ZERO } |
7 | LL | | }; | |
8 | | |__^ type validation failed: encountered a reference pointing to a static variable | |
9 | | | |
10 | = 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. | |
cdc7bbd5 | 11 | = note: the raw bytes of the constant (size: 8, align: 8) { |
136023e0 | 12 | ╾───────alloc1────────╼ │ ╾──────╼ |
cdc7bbd5 | 13 | } |
f9f354fc XL |
14 | |
15 | error: could not evaluate constant pattern | |
17df50a5 | 16 | --> $DIR/const_refers_to_static_cross_crate.rs:40:9 |
f9f354fc XL |
17 | | |
18 | LL | SLICE_MUT => true, | |
19 | | ^^^^^^^^^ | |
20 | ||
21 | error[E0080]: it is undefined behavior to use this value | |
17df50a5 | 22 | --> $DIR/const_refers_to_static_cross_crate.rs:17:1 |
f9f354fc XL |
23 | | |
24 | LL | / const U8_MUT: &u8 = { | |
25 | LL | | | |
f9f354fc XL |
26 | LL | | unsafe { &static_cross_crate::ZERO[0] } |
27 | LL | | }; | |
28 | | |__^ type validation failed: encountered a reference pointing to a static variable | |
29 | | | |
30 | = 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. | |
cdc7bbd5 | 31 | = note: the raw bytes of the constant (size: 8, align: 8) { |
136023e0 | 32 | ╾───────alloc1────────╼ │ ╾──────╼ |
cdc7bbd5 | 33 | } |
f9f354fc XL |
34 | |
35 | error: could not evaluate constant pattern | |
17df50a5 | 36 | --> $DIR/const_refers_to_static_cross_crate.rs:49:9 |
f9f354fc XL |
37 | | |
38 | LL | U8_MUT => true, | |
39 | | ^^^^^^ | |
40 | ||
41 | warning: any use of this value will cause an error | |
17df50a5 | 42 | --> $DIR/const_refers_to_static_cross_crate.rs:25:15 |
f9f354fc XL |
43 | | |
44 | LL | / const U8_MUT2: &u8 = { | |
45 | LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | |
5869c6ff XL |
46 | | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static |
47 | LL | | | |
48 | LL | | | |
f9f354fc | 49 | LL | | |
f9f354fc XL |
50 | LL | | }; |
51 | | |__- | |
52 | | | |
53 | note: the lint level is defined here | |
17df50a5 | 54 | --> $DIR/const_refers_to_static_cross_crate.rs:23:8 |
f9f354fc XL |
55 | | |
56 | LL | #[warn(const_err)] | |
57 | | ^^^^^^^^^ | |
5869c6ff XL |
58 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
59 | = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | |
f9f354fc XL |
60 | |
61 | error: could not evaluate constant pattern | |
17df50a5 | 62 | --> $DIR/const_refers_to_static_cross_crate.rs:60:9 |
f9f354fc XL |
63 | | |
64 | LL | U8_MUT2 => true, | |
65 | | ^^^^^^^ | |
66 | ||
67 | warning: any use of this value will cause an error | |
17df50a5 | 68 | --> $DIR/const_refers_to_static_cross_crate.rs:32:51 |
f9f354fc XL |
69 | | |
70 | LL | / const U8_MUT3: &u8 = { | |
71 | LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
72 | | | ^^^^^^^^^^^ constant accesses static | |
73 | LL | | | |
74 | LL | | | |
5869c6ff | 75 | LL | | |
f9f354fc XL |
76 | LL | | }; |
77 | | |__- | |
78 | | | |
79 | note: the lint level is defined here | |
17df50a5 | 80 | --> $DIR/const_refers_to_static_cross_crate.rs:30:8 |
f9f354fc XL |
81 | | |
82 | LL | #[warn(const_err)] | |
83 | | ^^^^^^^^^ | |
5869c6ff XL |
84 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
85 | = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | |
f9f354fc XL |
86 | |
87 | error: could not evaluate constant pattern | |
17df50a5 | 88 | --> $DIR/const_refers_to_static_cross_crate.rs:68:9 |
f9f354fc XL |
89 | | |
90 | LL | U8_MUT3 => true, | |
91 | | ^^^^^^^ | |
92 | ||
93 | error: could not evaluate constant pattern | |
17df50a5 | 94 | --> $DIR/const_refers_to_static_cross_crate.rs:40:9 |
f9f354fc XL |
95 | | |
96 | LL | SLICE_MUT => true, | |
97 | | ^^^^^^^^^ | |
98 | ||
99 | error: could not evaluate constant pattern | |
17df50a5 | 100 | --> $DIR/const_refers_to_static_cross_crate.rs:49:9 |
f9f354fc XL |
101 | | |
102 | LL | U8_MUT => true, | |
103 | | ^^^^^^ | |
104 | ||
105 | error: could not evaluate constant pattern | |
17df50a5 | 106 | --> $DIR/const_refers_to_static_cross_crate.rs:60:9 |
f9f354fc XL |
107 | | |
108 | LL | U8_MUT2 => true, | |
109 | | ^^^^^^^ | |
110 | ||
111 | error: could not evaluate constant pattern | |
17df50a5 | 112 | --> $DIR/const_refers_to_static_cross_crate.rs:68:9 |
f9f354fc XL |
113 | | |
114 | LL | U8_MUT3 => true, | |
115 | | ^^^^^^^ | |
116 | ||
117 | warning: skipping const checks | |
118 | | | |
119 | help: skipping check that does not even have a feature gate | |
17df50a5 | 120 | --> $DIR/const_refers_to_static_cross_crate.rs:14:15 |
f9f354fc XL |
121 | | |
122 | LL | unsafe { &static_cross_crate::ZERO } | |
123 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
124 | help: skipping check that does not even have a feature gate | |
17df50a5 | 125 | --> $DIR/const_refers_to_static_cross_crate.rs:14:15 |
f9f354fc XL |
126 | | |
127 | LL | unsafe { &static_cross_crate::ZERO } | |
128 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
129 | help: skipping check that does not even have a feature gate | |
17df50a5 | 130 | --> $DIR/const_refers_to_static_cross_crate.rs:19:15 |
f9f354fc XL |
131 | | |
132 | LL | unsafe { &static_cross_crate::ZERO[0] } | |
133 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
134 | help: skipping check that does not even have a feature gate | |
17df50a5 | 135 | --> $DIR/const_refers_to_static_cross_crate.rs:19:15 |
f9f354fc XL |
136 | | |
137 | LL | unsafe { &static_cross_crate::ZERO[0] } | |
138 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
139 | help: skipping check that does not even have a feature gate | |
17df50a5 | 140 | --> $DIR/const_refers_to_static_cross_crate.rs:19:15 |
f9f354fc XL |
141 | | |
142 | LL | unsafe { &static_cross_crate::ZERO[0] } | |
143 | | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
144 | help: skipping check that does not even have a feature gate | |
17df50a5 | 145 | --> $DIR/const_refers_to_static_cross_crate.rs:25:17 |
f9f354fc XL |
146 | | |
147 | LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | |
148 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
149 | help: skipping check that does not even have a feature gate | |
17df50a5 | 150 | --> $DIR/const_refers_to_static_cross_crate.rs:32:20 |
f9f354fc XL |
151 | | |
152 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
153 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
fc512014 | 154 | help: skipping check that does not even have a feature gate |
17df50a5 | 155 | --> $DIR/const_refers_to_static_cross_crate.rs:32:20 |
fc512014 XL |
156 | | |
157 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
158 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
f9f354fc | 159 | help: skipping check that does not even have a feature gate |
17df50a5 | 160 | --> $DIR/const_refers_to_static_cross_crate.rs:32:20 |
f9f354fc XL |
161 | | |
162 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
163 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
164 | help: skipping check for `const_panic` feature | |
17df50a5 | 165 | --> $DIR/const_refers_to_static_cross_crate.rs:32:77 |
f9f354fc XL |
166 | | |
167 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
168 | | ^^^^^^^^ | |
169 | help: skipping check that does not even have a feature gate | |
17df50a5 | 170 | --> $DIR/const_refers_to_static_cross_crate.rs:32:20 |
f9f354fc XL |
171 | | |
172 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | |
173 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
17df50a5 | 174 | = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) |
f9f354fc XL |
175 | |
176 | error: aborting due to 10 previous errors; 3 warnings emitted | |
177 | ||
178 | For more information about this error, try `rustc --explain E0080`. |