From 8e7ade85e60f2834f6f6637d916c5709a33a9109 Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Sun, 9 Jun 2019 19:02:28 -0700 Subject: [PATCH] Reword const fn conditional and loop error text --- src/librustc_mir/transform/qualify_min_const_fn.rs | 2 +- src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr | 8 ++++---- src/test/ui/consts/min_const_fn/min_const_fn.rs | 6 +++--- src/test/ui/consts/min_const_fn/min_const_fn.stderr | 8 ++++---- src/test/ui/consts/single_variant_match_ice.rs | 2 +- src/test/ui/consts/single_variant_match_ice.stderr | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 4811380e23860..ff4459dd3577f 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -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())) diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index 7a10c469c51a0..abbdb4ab632dc 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -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 } } @@ -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 { } } @@ -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 } @@ -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 } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 96b6057c8fd2d..40e7107e4a15e 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -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 diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index e388b443d2344..28a5ffb201594 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -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 } } @@ -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 { } } @@ -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 } @@ -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 } diff --git a/src/test/ui/consts/single_variant_match_ice.rs b/src/test/ui/consts/single_variant_match_ice.rs index 79dde3c18e8fa..6002506689e12 100644 --- a/src/test/ui/consts/single_variant_match_ice.rs +++ b/src/test/ui/consts/single_variant_match_ice.rs @@ -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 } } } diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr index b8ad775f1c34f..1e092c8af9967 100644 --- a/src/test/ui/consts/single_variant_match_ice.stderr +++ b/src/test/ui/consts/single_variant_match_ice.stderr @@ -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,