Test that stable const fn
requires allow_internal_unstable
This commit is contained in:
parent
09b5c854de
commit
1d418a1191
src/test/ui/internal
10
src/test/ui/internal/internal-unstable-const.rs
Normal file
10
src/test/ui/internal/internal-unstable-const.rs
Normal file
@ -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() {}
|
12
src/test/ui/internal/internal-unstable-const.stderr
Normal file
12
src/test/ui/internal/internal-unstable-const.stderr
Normal file
@ -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`.
|
Loading…
x
Reference in New Issue
Block a user