@@ -3,42 +3,90 @@ error: encountered mutable pointer in final value of static
33 |
44LL | static REF: &AtomicI32 = &AtomicI32::new(42);
55 | ^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
9+ note: the lint level is defined here
10+ --> $DIR/static-no-inner-mut.rs:6:9
11+ |
12+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
13+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
614
715error: encountered mutable pointer in final value of static
8- --> $DIR/static-no-inner-mut.rs:10 :1
16+ --> $DIR/static-no-inner-mut.rs:13 :1
917 |
1018LL | static REFMUT: &mut i32 = &mut 0;
1119 | ^^^^^^^^^^^^^^^^^^^^^^^
20+ |
21+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
1223
13- error: encountered mutable pointer in final value of static
24+ error[E0080]: it is undefined behavior to use this value
1425 --> $DIR/static-no-inner-mut.rs:13:1
1526 |
27+ LL | static REFMUT: &mut i32 = &mut 0;
28+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
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.
31+ = note: the raw bytes of the constant (size: 4, align: 4) {
32+ ╾ALLOC0╼ │ ╾──╼
33+ }
34+
35+ error: encountered mutable pointer in final value of static
36+ --> $DIR/static-no-inner-mut.rs:19:1
37+ |
1638LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
1739 | ^^^^^^^^^^^^^^^^^^^^^^^
40+ |
41+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
42+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
1843
1944error: encountered mutable pointer in final value of static
20- --> $DIR/static-no-inner-mut.rs:14 :1
45+ --> $DIR/static-no-inner-mut.rs:23 :1
2146 |
2247LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
2348 | ^^^^^^^^^^^^^^^^^^^^^^^^
49+ |
50+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
51+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
52+
53+ error[E0080]: it is undefined behavior to use this value
54+ --> $DIR/static-no-inner-mut.rs:23:1
55+ |
56+ LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
57+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
58+ |
59+ = 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.
60+ = note: the raw bytes of the constant (size: 4, align: 4) {
61+ ╾ALLOC1╼ │ ╾──╼
62+ }
2463
2564error: encountered mutable pointer in final value of static
26- --> $DIR/static-no-inner-mut.rs:29 :1
65+ --> $DIR/static-no-inner-mut.rs:41 :1
2766 |
2867LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
2968 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69+ |
70+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
71+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
3072
3173error: encountered mutable pointer in final value of static
32- --> $DIR/static-no-inner-mut.rs:31 :1
74+ --> $DIR/static-no-inner-mut.rs:45 :1
3375 |
3476LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
3577 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78+ |
79+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
3681
3782error: encountered mutable pointer in final value of static
38- --> $DIR/static-no-inner-mut.rs:33 :1
83+ --> $DIR/static-no-inner-mut.rs:49 :1
3984 |
4085LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
4186 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87+ |
88+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
89+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
4290
4391warning: skipping const checks
4492 |
@@ -48,35 +96,141 @@ help: skipping check that does not even have a feature gate
4896LL | static REF: &AtomicI32 = &AtomicI32::new(42);
4997 | ^^^^^^^^^^^^^^^^^^^
5098help: skipping check that does not even have a feature gate
51- --> $DIR/static-no-inner-mut.rs:10 :27
99+ --> $DIR/static-no-inner-mut.rs:13 :27
52100 |
53101LL | static REFMUT: &mut i32 = &mut 0;
54102 | ^^^^^^
55103help: skipping check that does not even have a feature gate
56- --> $DIR/static-no-inner-mut.rs:13 :56
104+ --> $DIR/static-no-inner-mut.rs:19 :56
57105 |
58106LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
59107 | ^^^^
60108help: skipping check that does not even have a feature gate
61- --> $DIR/static-no-inner-mut.rs:14 :44
109+ --> $DIR/static-no-inner-mut.rs:23 :44
62110 |
63111LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
64112 | ^^^^^^^^
65113help: skipping check that does not even have a feature gate
66- --> $DIR/static-no-inner-mut.rs:29 :52
114+ --> $DIR/static-no-inner-mut.rs:41 :52
67115 |
68116LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
69117 | ^^^^^^^^^^^^^^^^^^^
70118help: skipping check that does not even have a feature gate
71- --> $DIR/static-no-inner-mut.rs:31 :51
119+ --> $DIR/static-no-inner-mut.rs:45 :51
72120 |
73121LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
74122 | ^^^^^^^
75123help: skipping check that does not even have a feature gate
76- --> $DIR/static-no-inner-mut.rs:33 :52
124+ --> $DIR/static-no-inner-mut.rs:49 :52
77125 |
78126LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
79127 | ^^^^^^
80128
81- error: aborting due to 7 previous errors; 1 warning emitted
129+ error: aborting due to 9 previous errors; 1 warning emitted
130+
131+ For more information about this error, try `rustc --explain E0080`.
132+ Future incompatibility report: Future breakage diagnostic:
133+ error: encountered mutable pointer in final value of static
134+ --> $DIR/static-no-inner-mut.rs:9:1
135+ |
136+ LL | static REF: &AtomicI32 = &AtomicI32::new(42);
137+ | ^^^^^^^^^^^^^^^^^^^^^^
138+ |
139+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
140+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
141+ note: the lint level is defined here
142+ --> $DIR/static-no-inner-mut.rs:6:9
143+ |
144+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
145+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146+
147+ Future breakage diagnostic:
148+ error: encountered mutable pointer in final value of static
149+ --> $DIR/static-no-inner-mut.rs:13:1
150+ |
151+ LL | static REFMUT: &mut i32 = &mut 0;
152+ | ^^^^^^^^^^^^^^^^^^^^^^^
153+ |
154+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
155+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
156+ note: the lint level is defined here
157+ --> $DIR/static-no-inner-mut.rs:6:9
158+ |
159+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
160+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
161+
162+ Future breakage diagnostic:
163+ error: encountered mutable pointer in final value of static
164+ --> $DIR/static-no-inner-mut.rs:19:1
165+ |
166+ LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
167+ | ^^^^^^^^^^^^^^^^^^^^^^^
168+ |
169+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
170+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
171+ note: the lint level is defined here
172+ --> $DIR/static-no-inner-mut.rs:6:9
173+ |
174+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
175+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176+
177+ Future breakage diagnostic:
178+ error: encountered mutable pointer in final value of static
179+ --> $DIR/static-no-inner-mut.rs:23:1
180+ |
181+ LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
182+ | ^^^^^^^^^^^^^^^^^^^^^^^^
183+ |
184+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
185+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
186+ note: the lint level is defined here
187+ --> $DIR/static-no-inner-mut.rs:6:9
188+ |
189+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
190+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191+
192+ Future breakage diagnostic:
193+ error: encountered mutable pointer in final value of static
194+ --> $DIR/static-no-inner-mut.rs:41:1
195+ |
196+ LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
197+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198+ |
199+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
200+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
201+ note: the lint level is defined here
202+ --> $DIR/static-no-inner-mut.rs:6:9
203+ |
204+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
205+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
206+
207+ Future breakage diagnostic:
208+ error: encountered mutable pointer in final value of static
209+ --> $DIR/static-no-inner-mut.rs:45:1
210+ |
211+ LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
212+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
213+ |
214+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
215+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
216+ note: the lint level is defined here
217+ --> $DIR/static-no-inner-mut.rs:6:9
218+ |
219+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
220+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221+
222+ Future breakage diagnostic:
223+ error: encountered mutable pointer in final value of static
224+ --> $DIR/static-no-inner-mut.rs:49:1
225+ |
226+ LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
227+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
228+ |
229+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
230+ = note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
231+ note: the lint level is defined here
232+ --> $DIR/static-no-inner-mut.rs:6:9
233+ |
234+ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
235+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82236
0 commit comments