diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-20 07:16:26 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-06 06:43:58 +0200 |
| commit | e7b544ee836831b1b469f62816ab965b2790351c (patch) | |
| tree | 34553935b3eee13157f309e31825cd3dba31e248 /src | |
| parent | f8b32dfb27976f52b47bb278fee397b65efddc18 (diff) | |
| download | rust-e7b544ee836831b1b469f62816ab965b2790351c.tar.gz rust-e7b544ee836831b1b469f62816ab965b2790351c.zip | |
min_const_fn: change error message due to changed desugaring.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/min_const_fn/min_const_fn.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/consts/min_const_fn/min_const_fn.stderr | 34 |
2 files changed, 19 insertions, 18 deletions
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 9523fcbfc60..8b423da7882 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 @@ -99,7 +99,8 @@ 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 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_5(b: bool) { while b { } } +//~^ ERROR loops are not allowed in const fn const fn foo30_6() -> bool { let x = true; x } const fn foo36(a: bool, b: bool) -> bool { a && b } //~^ ERROR loops and conditional expressions are not stable in const fn 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 28a5ffb2015..66cfe7fa024 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 @@ -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]: loops and conditional expressions are not stable in const fn +error[E0723]: loops are not allowed in const fn --> $DIR/min_const_fn.rs:102:29 | LL | const fn foo30_5(b: bool) { while b { } } @@ -179,7 +179,7 @@ LL | const fn foo30_5(b: bool) { while b { } } = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: loops and conditional expressions are not stable in const fn - --> $DIR/min_const_fn.rs:104:44 + --> $DIR/min_const_fn.rs:105:44 | LL | const fn foo36(a: bool, b: bool) -> bool { a && b } | ^^^^^^ @@ -188,7 +188,7 @@ LL | const fn foo36(a: bool, b: bool) -> bool { a && b } = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: loops and conditional expressions are not stable in const fn - --> $DIR/min_const_fn.rs:106:44 + --> $DIR/min_const_fn.rs:107:44 | LL | const fn foo37(a: bool, b: bool) -> bool { a || b } | ^^^^^^ @@ -197,7 +197,7 @@ LL | const fn foo37(a: bool, b: bool) -> bool { a || b } = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:108:14 + --> $DIR/min_const_fn.rs:109:14 | LL | const fn inc(x: &mut i32) { *x += 1 } | ^ @@ -206,7 +206,7 @@ LL | const fn inc(x: &mut i32) { *x += 1 } = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:113:6 + --> $DIR/min_const_fn.rs:114:6 | LL | impl<T: std::fmt::Debug> Foo<T> { | ^ @@ -215,7 +215,7 @@ LL | impl<T: std::fmt::Debug> Foo<T> { = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:118:6 + --> $DIR/min_const_fn.rs:119:6 | LL | impl<T: std::fmt::Debug + Sized> Foo<T> { | ^ @@ -224,7 +224,7 @@ LL | impl<T: std::fmt::Debug + Sized> Foo<T> { = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:123:6 + --> $DIR/min_const_fn.rs:124:6 | LL | impl<T: Sync + Sized> Foo<T> { | ^ @@ -233,7 +233,7 @@ LL | impl<T: Sync + Sized> Foo<T> { = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:129:24 + --> $DIR/min_const_fn.rs:130:24 | LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -242,7 +242,7 @@ LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) } = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:131:34 + --> $DIR/min_const_fn.rs:132:34 | LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -251,7 +251,7 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {} = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:133:22 + --> $DIR/min_const_fn.rs:134:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -260,7 +260,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:134:23 + --> $DIR/min_const_fn.rs:135:23 | LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:135:23 + --> $DIR/min_const_fn.rs:136:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ @@ -278,7 +278,7 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:136:32 + --> $DIR/min_const_fn.rs:137:32 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } = help: add #![feature(const_fn)] to the crate attributes to enable warning[E0515]: cannot return reference to temporary value - --> $DIR/min_const_fn.rs:136:63 + --> $DIR/min_const_fn.rs:137:63 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^-- @@ -300,7 +300,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } = note: for more information, try `rustc --explain E0729` error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:144:41 + --> $DIR/min_const_fn.rs:145:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -309,7 +309,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:147:21 + --> $DIR/min_const_fn.rs:148:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ @@ -318,7 +318,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {} = help: add #![feature(const_fn)] to the crate attributes to enable error[E0723]: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:149:27 + --> $DIR/min_const_fn.rs:150:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ |
