rust/tests/ui/internal/internal-unstable-const.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
463 B
Rust
Raw Normal View History

2020-06-26 00:43:48 +00:00
// Don't allow unstable features in stable functions without `allow_internal_unstable`.
2020-05-21 19:49:38 +00:00
#![stable(feature = "rust1", since = "1.0.0")]
#![feature(staged_api)]
2021-06-03 07:31:27 +00:00
#![feature(const_fn_floating_point_arithmetic)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
2021-06-03 07:31:27 +00:00
pub const fn foo() -> f32 {
1.0 + 1.0 //~ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
}
fn main() {}