Skip to content

Commit 8e7ade8

Browse files
committed
Reword const fn conditional and loop error text
1 parent e22b7a3 commit 8e7ade8

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/librustc_mir/transform/qualify_min_const_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ fn check_terminator(
299299

300300
TerminatorKind::FalseEdges { .. } | TerminatorKind::SwitchInt { .. } => Err((
301301
span,
302-
"`if`, `match`, `&&` and `||` are not stable in const fn".into(),
302+
"loops and conditional expressions are not stable in const fn".into(),
303303
)),
304304
| TerminatorKind::Abort | TerminatorKind::Unreachable => {
305305
Err((span, "const fn with unreachable code is not stable".into()))

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize }
160160
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
161161
= help: add #![feature(const_fn)] to the crate attributes to enable
162162

163-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
163+
error[E0723]: loops and conditional expressions are not stable in const fn
164164
--> $DIR/min_const_fn.rs:100:38
165165
|
166166
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
@@ -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]: `if`, `match`, `&&` and `||` are not stable in const fn
172+
error[E0723]: loops and conditional expressions are not stable in const fn
173173
--> $DIR/min_const_fn.rs:102:29
174174
|
175175
LL | const fn foo30_5(b: bool) { while b { } }
@@ -178,7 +178,7 @@ LL | const fn foo30_5(b: bool) { while b { } }
178178
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
179179
= help: add #![feature(const_fn)] to the crate attributes to enable
180180

181-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
181+
error[E0723]: loops and conditional expressions are not stable in const fn
182182
--> $DIR/min_const_fn.rs:104:44
183183
|
184184
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
@@ -187,7 +187,7 @@ LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
187187
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
188188
= help: add #![feature(const_fn)] to the crate attributes to enable
189189

190-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
190+
error[E0723]: loops and conditional expressions are not stable in const fn
191191
--> $DIR/min_const_fn.rs:106:44
192192
|
193193
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ const fn foo30_2(x: *mut u32) -> usize { x as usize }
9898
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 } }
101-
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
101+
//~^ ERROR loops and conditional expressions are not stable in const fn
102102
const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
103103
const fn foo30_6() -> bool { let x = true; x }
104104
const fn foo36(a: bool, b: bool) -> bool { a && b }
105-
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
105+
//~^ ERROR loops and conditional expressions are not stable in const fn
106106
const fn foo37(a: bool, b: bool) -> bool { a || b }
107-
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
107+
//~^ ERROR loops and conditional expressions are not stable in const fn
108108
const fn inc(x: &mut i32) { *x += 1 }
109109
//~^ ERROR mutable references in const fn are unstable
110110

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize }
160160
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
161161
= help: add #![feature(const_fn)] to the crate attributes to enable
162162

163-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
163+
error[E0723]: loops and conditional expressions are not stable in const fn
164164
--> $DIR/min_const_fn.rs:100:38
165165
|
166166
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
@@ -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]: `if`, `match`, `&&` and `||` are not stable in const fn
172+
error[E0723]: loops and conditional expressions are not stable in const fn
173173
--> $DIR/min_const_fn.rs:102:29
174174
|
175175
LL | const fn foo30_5(b: bool) { while b { } }
@@ -178,7 +178,7 @@ LL | const fn foo30_5(b: bool) { while b { } }
178178
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
179179
= help: add #![feature(const_fn)] to the crate attributes to enable
180180

181-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
181+
error[E0723]: loops and conditional expressions are not stable in const fn
182182
--> $DIR/min_const_fn.rs:104:44
183183
|
184184
LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
@@ -187,7 +187,7 @@ LL | const fn foo36(a: bool, b: bool) -> bool { a && b }
187187
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
188188
= help: add #![feature(const_fn)] to the crate attributes to enable
189189

190-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
190+
error[E0723]: loops and conditional expressions are not stable in const fn
191191
--> $DIR/min_const_fn.rs:106:44
192192
|
193193
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }

src/test/ui/consts/single_variant_match_ice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl Foo {
1515
use self::Foo::*;
1616

1717
match *self {
18-
Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
18+
Prob => 0x1, //~ ERROR loops and conditional expressions are not stable in const fn
1919
}
2020
}
2121
}

src/test/ui/consts/single_variant_match_ice.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0019]: constant contains unimplemented expression type
1010
LL | x => 42,
1111
| ^
1212

13-
error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
13+
error[E0723]: loops and conditional expressions are not stable in const fn
1414
--> $DIR/single_variant_match_ice.rs:18:13
1515
|
1616
LL | Prob => 0x1,

0 commit comments

Comments
 (0)