Skip to content

Commit

Permalink
Reword const fn conditional and loop error text
Browse files Browse the repository at this point in the history
  • Loading branch information
czipperz committed Jun 10, 2019
1 parent e22b7a3 commit 8e7ade8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/qualify_min_const_fn.rs
Expand Up @@ -299,7 +299,7 @@ fn check_terminator(

TerminatorKind::FalseEdges { .. } | TerminatorKind::SwitchInt { .. } => Err((
span,
"`if`, `match`, `&&` and `||` are not stable in const fn".into(),
"loops and conditional expressions are not stable in const fn".into(),
)),
| TerminatorKind::Abort | TerminatorKind::Unreachable => {
Err((span, "const fn with unreachable code is not stable".into()))
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr
Expand Up @@ -160,7 +160,7 @@ LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:100:38
|
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
Expand All @@ -169,7 +169,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:102:29
|
LL | const fn foo30_5(b: bool) { while b { } }
Expand All @@ -178,7 +178,7 @@ LL | const fn foo30_5(b: bool) { while b { } }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

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

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:106:44
|
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/consts/min_const_fn/min_const_fn.rs
Expand Up @@ -98,13 +98,13 @@ const fn foo30_2(x: *mut u32) -> usize { x as usize }
const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
//~^ ERROR casting pointers to ints is unstable
const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
//~^ ERROR loops and conditional expressions are not stable in const fn
const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn
const fn foo30_6() -> bool { let x = true; x }
const fn foo36(a: bool, b: bool) -> bool { a && b }
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
//~^ ERROR loops and conditional expressions are not stable in const fn
const fn foo37(a: bool, b: bool) -> bool { a || b }
//~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
//~^ ERROR loops and conditional expressions are not stable in const fn
const fn inc(x: &mut i32) { *x += 1 }
//~^ ERROR mutable references in const fn are unstable

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/consts/min_const_fn/min_const_fn.stderr
Expand Up @@ -160,7 +160,7 @@ LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:100:38
|
LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
Expand All @@ -169,7 +169,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:102:29
|
LL | const fn foo30_5(b: bool) { while b { } }
Expand All @@ -178,7 +178,7 @@ LL | const fn foo30_5(b: bool) { while b { } }
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable

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

error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/min_const_fn.rs:106:44
|
LL | const fn foo37(a: bool, b: bool) -> bool { a || b }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/single_variant_match_ice.rs
Expand Up @@ -15,7 +15,7 @@ impl Foo {
use self::Foo::*;

match *self {
Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
Prob => 0x1, //~ ERROR loops and conditional expressions are not stable in const fn
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/single_variant_match_ice.stderr
Expand Up @@ -10,7 +10,7 @@ error[E0019]: constant contains unimplemented expression type
LL | x => 42,
| ^

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

0 comments on commit 8e7ade8

Please sign in to comment.