Skip to content

Commit 8ca4406

Browse files
committed
Add updated NLL tests
1 parent 519783a commit 8ca4406

File tree

2 files changed

+108
-37
lines changed

2 files changed

+108
-37
lines changed

src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr

+100-34
Original file line numberDiff line numberDiff line change
@@ -4,197 +4,257 @@ error[E0493]: destructors cannot be evaluated at compile-time
44
LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated
55
| ^^^^ constant functions cannot evaluate destructors
66

7-
error: mutable references in const fn are unstable
7+
error[E0723]: mutable references in const fn are unstable (see issue #57563)
88
--> $DIR/min_const_fn.rs:39:36
99
|
1010
LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
1111
| ^^^^^^
12+
|
13+
= help: add #![feature(const_fn)] to the crate attributes to enable
1214

1315
error[E0493]: destructors cannot be evaluated at compile-time
1416
--> $DIR/min_const_fn.rs:44:28
1517
|
1618
LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated
1719
| ^^^^ constant functions cannot evaluate destructors
1820

19-
error: mutable references in const fn are unstable
21+
error[E0723]: mutable references in const fn are unstable (see issue #57563)
2022
--> $DIR/min_const_fn.rs:46:42
2123
|
2224
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
2325
| ^^^^^^
26+
|
27+
= help: add #![feature(const_fn)] to the crate attributes to enable
2428

2529
error[E0493]: destructors cannot be evaluated at compile-time
2630
--> $DIR/min_const_fn.rs:51:27
2731
|
2832
LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors
2933
| ^^^^ constant functions cannot evaluate destructors
3034

31-
error: mutable references in const fn are unstable
35+
error[E0723]: mutable references in const fn are unstable (see issue #57563)
3236
--> $DIR/min_const_fn.rs:53:38
3337
|
3438
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
3539
| ^^^^^^
40+
|
41+
= help: add #![feature(const_fn)] to the crate attributes to enable
3642

37-
error: mutable references in const fn are unstable
43+
error[E0723]: mutable references in const fn are unstable (see issue #57563)
3844
--> $DIR/min_const_fn.rs:58:39
3945
|
4046
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
4147
| ^^^^^^
48+
|
49+
= help: add #![feature(const_fn)] to the crate attributes to enable
4250

43-
error: trait bounds other than `Sized` on const fn parameters are unstable
51+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
4452
--> $DIR/min_const_fn.rs:76:16
4553
|
4654
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
4755
| ^
56+
|
57+
= help: add #![feature(const_fn)] to the crate attributes to enable
4858

49-
error: trait bounds other than `Sized` on const fn parameters are unstable
59+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
5060
--> $DIR/min_const_fn.rs:78:18
5161
|
5262
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
5363
| ^
64+
|
65+
= help: add #![feature(const_fn)] to the crate attributes to enable
5466

55-
error: only int, `bool` and `char` operations are stable in const fn
67+
error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
5668
--> $DIR/min_const_fn.rs:80:33
5769
|
5870
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
5971
| ^^^^^^^
72+
|
73+
= help: add #![feature(const_fn)] to the crate attributes to enable
6074

61-
error: only int, `bool` and `char` operations are stable in const fn
75+
error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
6276
--> $DIR/min_const_fn.rs:82:35
6377
|
6478
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
6579
| ^^^^^^^
80+
|
81+
= help: add #![feature(const_fn)] to the crate attributes to enable
6682

67-
error: only int and `bool` operations are stable in const fn
83+
error[E0723]: only int and `bool` operations are stable in const fn (see issue #57563)
6884
--> $DIR/min_const_fn.rs:84:35
6985
|
7086
LL | const fn foo19_3(f: f32) -> f32 { -f }
7187
| ^^
88+
|
89+
= help: add #![feature(const_fn)] to the crate attributes to enable
7290

73-
error: only int, `bool` and `char` operations are stable in const fn
91+
error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563)
7492
--> $DIR/min_const_fn.rs:86:43
7593
|
7694
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
7795
| ^^^^^
96+
|
97+
= help: add #![feature(const_fn)] to the crate attributes to enable
7898

79-
error: cannot access `static` items in const fn
99+
error[E0723]: cannot access `static` items in const fn (see issue #57563)
80100
--> $DIR/min_const_fn.rs:90:27
81101
|
82102
LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn
83103
| ^^^
104+
|
105+
= help: add #![feature(const_fn)] to the crate attributes to enable
84106

85-
error: cannot access `static` items in const fn
107+
error[E0723]: cannot access `static` items in const fn (see issue #57563)
86108
--> $DIR/min_const_fn.rs:91:36
87109
|
88110
LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items
89111
| ^^^^
112+
|
113+
= help: add #![feature(const_fn)] to the crate attributes to enable
90114

91-
error: casting pointers to ints is unstable in const fn
115+
error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
92116
--> $DIR/min_const_fn.rs:92:42
93117
|
94118
LL | const fn foo30(x: *const u32) -> usize { x as usize }
95119
| ^^^^^^^^^^
120+
|
121+
= help: add #![feature(const_fn)] to the crate attributes to enable
96122

97-
error: casting pointers to ints is unstable in const fn
123+
error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
98124
--> $DIR/min_const_fn.rs:94:63
99125
|
100126
LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
101127
| ^^^^^^^^^^
128+
|
129+
= help: add #![feature(const_fn)] to the crate attributes to enable
102130

103-
error: casting pointers to ints is unstable in const fn
131+
error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
104132
--> $DIR/min_const_fn.rs:96:42
105133
|
106134
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
107135
| ^^^^^^^^^^
136+
|
137+
= help: add #![feature(const_fn)] to the crate attributes to enable
108138

109-
error: casting pointers to ints is unstable in const fn
139+
error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)
110140
--> $DIR/min_const_fn.rs:98:63
111141
|
112142
LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
113143
| ^^^^^^^^^^
144+
|
145+
= help: add #![feature(const_fn)] to the crate attributes to enable
114146

115-
error: `if`, `match`, `&&` and `||` are not stable in const fn
147+
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
116148
--> $DIR/min_const_fn.rs:100:38
117149
|
118150
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
119151
| ^^^^^^^^^^^^^^^^^^^^^^
152+
|
153+
= help: add #![feature(const_fn)] to the crate attributes to enable
120154

121-
error: `if`, `match`, `&&` and `||` are not stable in const fn
155+
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
122156
--> $DIR/min_const_fn.rs:102:29
123157
|
124158
LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
125159
| ^^^^^^^^^^^
160+
|
161+
= help: add #![feature(const_fn)] to the crate attributes to enable
126162

127-
error: `if`, `match`, `&&` and `||` are not stable in const fn
163+
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
128164
--> $DIR/min_const_fn.rs:104:44
129165
|
130166
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
131167
| ^^^^^^
168+
|
169+
= help: add #![feature(const_fn)] to the crate attributes to enable
132170

133-
error: `if`, `match`, `&&` and `||` are not stable in const fn
171+
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563)
134172
--> $DIR/min_const_fn.rs:106:44
135173
|
136174
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
137175
| ^^^^^^
176+
|
177+
= help: add #![feature(const_fn)] to the crate attributes to enable
138178

139-
error: mutable references in const fn are unstable
179+
error[E0723]: mutable references in const fn are unstable (see issue #57563)
140180
--> $DIR/min_const_fn.rs:108:14
141181
|
142182
LL | const fn inc(x: &mut i32) { *x += 1 }
143183
| ^
184+
|
185+
= help: add #![feature(const_fn)] to the crate attributes to enable
144186

145-
error: trait bounds other than `Sized` on const fn parameters are unstable
187+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
146188
--> $DIR/min_const_fn.rs:113:6
147189
|
148190
LL | impl<T: std::fmt::Debug> Foo<T> {
149191
| ^
192+
|
193+
= help: add #![feature(const_fn)] to the crate attributes to enable
150194

151-
error: trait bounds other than `Sized` on const fn parameters are unstable
195+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
152196
--> $DIR/min_const_fn.rs:118:6
153197
|
154198
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
155199
| ^
200+
|
201+
= help: add #![feature(const_fn)] to the crate attributes to enable
156202

157-
error: trait bounds other than `Sized` on const fn parameters are unstable
203+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
158204
--> $DIR/min_const_fn.rs:123:6
159205
|
160206
LL | impl<T: Sync + Sized> Foo<T> {
161207
| ^
208+
|
209+
= help: add #![feature(const_fn)] to the crate attributes to enable
162210

163-
error: `impl Trait` in const fn is unstable
211+
error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
164212
--> $DIR/min_const_fn.rs:129:24
165213
|
166214
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
167215
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
216+
|
217+
= help: add #![feature(const_fn)] to the crate attributes to enable
168218

169-
error: trait bounds other than `Sized` on const fn parameters are unstable
219+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
170220
--> $DIR/min_const_fn.rs:131:34
171221
|
172222
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
173223
| ^^^^^^^^^^^^^^^^^^^^
224+
|
225+
= help: add #![feature(const_fn)] to the crate attributes to enable
174226

175-
error: trait bounds other than `Sized` on const fn parameters are unstable
227+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
176228
--> $DIR/min_const_fn.rs:133:22
177229
|
178230
LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
179231
| ^^^^^^^^^^^^^^^^^^^^
232+
|
233+
= help: add #![feature(const_fn)] to the crate attributes to enable
180234

181-
error: `impl Trait` in const fn is unstable
235+
error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
182236
--> $DIR/min_const_fn.rs:134:23
183237
|
184238
LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
185239
| ^^^^^^^^^^^^^^^^^^^^
240+
|
241+
= help: add #![feature(const_fn)] to the crate attributes to enable
186242

187-
error: trait bounds other than `Sized` on const fn parameters are unstable
243+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
188244
--> $DIR/min_const_fn.rs:135:23
189245
|
190246
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
191247
| ^^
248+
|
249+
= help: add #![feature(const_fn)] to the crate attributes to enable
192250

193-
error: trait bounds other than `Sized` on const fn parameters are unstable
251+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
194252
--> $DIR/min_const_fn.rs:136:32
195253
|
196254
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
197255
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
256+
|
257+
= help: add #![feature(const_fn)] to the crate attributes to enable
198258

199259
warning[E0515]: cannot return reference to temporary value
200260
--> $DIR/min_const_fn.rs:136:63
@@ -208,25 +268,31 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
208268
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
209269
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
210270

211-
error: trait bounds other than `Sized` on const fn parameters are unstable
271+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
212272
--> $DIR/min_const_fn.rs:141:41
213273
|
214274
LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }
215275
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
276+
|
277+
= help: add #![feature(const_fn)] to the crate attributes to enable
216278

217-
error: function pointers in const fn are unstable
279+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
218280
--> $DIR/min_const_fn.rs:144:21
219281
|
220282
LL | const fn no_fn_ptrs(_x: fn()) {}
221283
| ^^
284+
|
285+
= help: add #![feature(const_fn)] to the crate attributes to enable
222286

223-
error: function pointers in const fn are unstable
287+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
224288
--> $DIR/min_const_fn.rs:146:27
225289
|
226290
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
227291
| ^^^^
292+
|
293+
= help: add #![feature(const_fn)] to the crate attributes to enable
228294

229295
error: aborting due to 36 previous errors
230296

231-
Some errors occurred: E0493, E0515.
297+
Some errors occurred: E0493, E0515, E0723.
232298
For more information about an error, try `rustc --explain E0493`.

src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
error: trait bounds other than `Sized` on const fn parameters are unstable
1+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
22
--> $DIR/min_const_fn_dyn.rs:9:5
33
|
44
LL | x.0.field;
55
| ^^^^^^^^^
6+
|
7+
= help: add #![feature(const_fn)] to the crate attributes to enable
68

7-
error: trait bounds other than `Sized` on const fn parameters are unstable
9+
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563)
810
--> $DIR/min_const_fn_dyn.rs:12:66
911
|
1012
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
1113
| ^^
14+
|
15+
= help: add #![feature(const_fn)] to the crate attributes to enable
1216

1317
warning[E0716]: temporary value dropped while borrowed
1418
--> $DIR/min_const_fn_dyn.rs:12:67
@@ -24,4 +28,5 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
2428

2529
error: aborting due to 2 previous errors
2630

27-
For more information about this error, try `rustc --explain E0716`.
31+
Some errors occurred: E0716, E0723.
32+
For more information about an error, try `rustc --explain E0716`.

0 commit comments

Comments
 (0)