Skip to content

Commit 0511729

Browse files
committed
min_const_fn: change error message due to changed desugaring.
1 parent 7f26d26 commit 0511729

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/test/ui/consts/min_const_fn/min_const_fn.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
9999
//~^ ERROR casting pointers to ints is unstable
100100
const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
101101
//~^ ERROR loops and conditional expressions are not stable in const fn
102-
const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
102+
const fn foo30_5(b: bool) { while b { } }
103+
//~^ ERROR loops are not allowed in const fn
103104
const fn foo30_6() -> bool { let x = true; x }
104105
const fn foo36(a: bool, b: bool) -> bool { a && b }
105106
//~^ ERROR loops and conditional expressions are not stable in const fn

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
169169
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
170170
= help: add #![feature(const_fn)] to the crate attributes to enable
171171

172-
error[E0723]: loops and conditional expressions are not stable in const fn
172+
error[E0723]: loops are not allowed in const fn
173173
--> $DIR/min_const_fn.rs:102:29
174174
|
175175
LL | const fn foo30_5(b: bool) { while b { } }
@@ -179,7 +179,7 @@ LL | const fn foo30_5(b: bool) { while b { } }
179179
= help: add #![feature(const_fn)] to the crate attributes to enable
180180

181181
error[E0723]: loops and conditional expressions are not stable in const fn
182-
--> $DIR/min_const_fn.rs:104:44
182+
--> $DIR/min_const_fn.rs:105:44
183183
|
184184
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
185185
| ^^^^^^
@@ -188,7 +188,7 @@ LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
188188
= help: add #![feature(const_fn)] to the crate attributes to enable
189189

190190
error[E0723]: loops and conditional expressions are not stable in const fn
191-
--> $DIR/min_const_fn.rs:106:44
191+
--> $DIR/min_const_fn.rs:107:44
192192
|
193193
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
194194
| ^^^^^^
@@ -197,7 +197,7 @@ LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
197197
= help: add #![feature(const_fn)] to the crate attributes to enable
198198

199199
error[E0723]: mutable references in const fn are unstable
200-
--> $DIR/min_const_fn.rs:108:14
200+
--> $DIR/min_const_fn.rs:109:14
201201
|
202202
LL | const fn inc(x: &mut i32) { *x += 1 }
203203
| ^
@@ -206,7 +206,7 @@ LL | const fn inc(x: &mut i32) { *x += 1 }
206206
= help: add #![feature(const_fn)] to the crate attributes to enable
207207

208208
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
209-
--> $DIR/min_const_fn.rs:113:6
209+
--> $DIR/min_const_fn.rs:114:6
210210
|
211211
LL | impl<T: std::fmt::Debug> Foo<T> {
212212
| ^
@@ -215,7 +215,7 @@ LL | impl<T: std::fmt::Debug> Foo<T> {
215215
= help: add #![feature(const_fn)] to the crate attributes to enable
216216

217217
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
218-
--> $DIR/min_const_fn.rs:118:6
218+
--> $DIR/min_const_fn.rs:119:6
219219
|
220220
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
221221
| ^
@@ -224,7 +224,7 @@ LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
224224
= help: add #![feature(const_fn)] to the crate attributes to enable
225225

226226
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
227-
--> $DIR/min_const_fn.rs:123:6
227+
--> $DIR/min_const_fn.rs:124:6
228228
|
229229
LL | impl<T: Sync + Sized> Foo<T> {
230230
| ^
@@ -233,7 +233,7 @@ LL | impl<T: Sync + Sized> Foo<T> {
233233
= help: add #![feature(const_fn)] to the crate attributes to enable
234234

235235
error[E0723]: `impl Trait` in const fn is unstable
236-
--> $DIR/min_const_fn.rs:129:24
236+
--> $DIR/min_const_fn.rs:130:24
237237
|
238238
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
239239
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -242,7 +242,7 @@ LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
242242
= help: add #![feature(const_fn)] to the crate attributes to enable
243243

244244
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
245-
--> $DIR/min_const_fn.rs:131:34
245+
--> $DIR/min_const_fn.rs:132:34
246246
|
247247
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
248248
| ^^^^^^^^^^^^^^^^^^^^
@@ -251,7 +251,7 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
251251
= help: add #![feature(const_fn)] to the crate attributes to enable
252252

253253
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
254-
--> $DIR/min_const_fn.rs:133:22
254+
--> $DIR/min_const_fn.rs:134:22
255255
|
256256
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
257257
| ^^^^^^^^^^^^^^^^^^^^
@@ -260,7 +260,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {}
260260
= help: add #![feature(const_fn)] to the crate attributes to enable
261261

262262
error[E0723]: `impl Trait` in const fn is unstable
263-
--> $DIR/min_const_fn.rs:134:23
263+
--> $DIR/min_const_fn.rs:135:23
264264
|
265265
LL | const fn no_rpit() -> impl std::fmt::Debug {}
266266
| ^^^^^^^^^^^^^^^^^^^^
@@ -269,7 +269,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {}
269269
= help: add #![feature(const_fn)] to the crate attributes to enable
270270

271271
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
272-
--> $DIR/min_const_fn.rs:135:23
272+
--> $DIR/min_const_fn.rs:136:23
273273
|
274274
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
275275
| ^^
@@ -278,7 +278,7 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
278278
= help: add #![feature(const_fn)] to the crate attributes to enable
279279

280280
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
281-
--> $DIR/min_const_fn.rs:136:32
281+
--> $DIR/min_const_fn.rs:137:32
282282
|
283283
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
284284
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +287,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
287287
= help: add #![feature(const_fn)] to the crate attributes to enable
288288

289289
warning[E0515]: cannot return reference to temporary value
290-
--> $DIR/min_const_fn.rs:136:63
290+
--> $DIR/min_const_fn.rs:137:63
291291
|
292292
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
293293
| ^--
@@ -300,7 +300,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
300300
= note: for more information, try `rustc --explain E0729`
301301

302302
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
303-
--> $DIR/min_const_fn.rs:144:41
303+
--> $DIR/min_const_fn.rs:145:41
304304
|
305305
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
306306
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -309,7 +309,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1
309309
= help: add #![feature(const_fn)] to the crate attributes to enable
310310

311311
error[E0723]: function pointers in const fn are unstable
312-
--> $DIR/min_const_fn.rs:147:21
312+
--> $DIR/min_const_fn.rs:148:21
313313
|
314314
LL | const fn no_fn_ptrs(_x: fn()) {}
315315
| ^^
@@ -318,7 +318,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {}
318318
= help: add #![feature(const_fn)] to the crate attributes to enable
319319

320320
error[E0723]: function pointers in const fn are unstable
321-
--> $DIR/min_const_fn.rs:149:27
321+
--> $DIR/min_const_fn.rs:150:27
322322
|
323323
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
324324
| ^^^^

0 commit comments

Comments
 (0)