Test that stable const fn requires allow_internal_unstable

This commit is contained in:
Dylan MacKenzie 2020-01-10 18:48:52 -08:00
parent 09b5c854de
commit 1d418a1191
2 changed files with 22 additions and 0 deletions

@ -0,0 +1,10 @@
#![feature(staged_api)]
#![feature(const_if_match)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
const fn foo() -> i32 {
if true { 4 } else { 5 } //~ loops and conditional expressions are not stable in const fn
}
fn main() {}

@ -0,0 +1,12 @@
error[E0723]: loops and conditional expressions are not stable in const fn
--> $DIR/internal-unstable-const.rs:7:5
|
LL | if true { 4 } else { 5 }
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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: aborting due to previous error
For more information about this error, try `rustc --explain E0723`.