diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs index 4ce62ecc485..9f5d0ad5df3 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs @@ -13,7 +13,7 @@ we're apparently really bad at it", issue = "0")] -#![feature(rustc_const_unstable, const_fn, foo)] +#![feature(rustc_const_unstable, const_fn, foo, foo2)] #![feature(staged_api)] #[stable(feature = "rust1", since = "1.0.0")] @@ -35,4 +35,12 @@ const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` // conformity is required, even with `const_fn` feature gate const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations +// check whether this function cannot be called even with the feature gate active +#[unstable(feature = "foo2", issue="0")] +const fn foo2_gated() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` + fn main() {} diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 8e47090890d..1ef7ffd3a91 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -16,5 +16,11 @@ error: only int, `bool` and `char` operations are stable in const fn LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations | ^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_fn_libstd_stability.rs:44:32 + | +LL | const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors