rust/src/test/ui/internal/internal-unstable-const.rs

15 lines
412 B
Rust
Raw Normal View History

2020-06-25 19:43:48 -05:00
// Don't allow unstable features in stable functions without `allow_internal_unstable`.
2020-05-21 14:49:38 -05:00
#![stable(feature = "rust1", since = "1.0.0")]
#![feature(staged_api)]
2020-06-25 19:43:48 -05:00
#![feature(const_transmute, const_fn)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
2020-06-25 19:43:48 -05:00
pub const fn foo() -> i32 {
2020-09-24 13:12:28 -05:00
unsafe { std::mem::transmute(4u32) } //~ ERROR `transmute`
}
fn main() {}