Skip to content

Commit 1d418a1

Browse files
Test that stable const fn requires allow_internal_unstable
1 parent 09b5c85 commit 1d418a1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(staged_api)]
2+
#![feature(const_if_match)]
3+
4+
#[stable(feature = "rust1", since = "1.0.0")]
5+
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
6+
const fn foo() -> i32 {
7+
if true { 4 } else { 5 } //~ loops and conditional expressions are not stable in const fn
8+
}
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0723]: loops and conditional expressions are not stable in const fn
2+
--> $DIR/internal-unstable-const.rs:7:5
3+
|
4+
LL | if true { 4 } else { 5 }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
8+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0723`.

0 commit comments

Comments
 (0)