2018-05-19 19:19:20 -05:00
|
|
|
#![unstable(feature = "humans",
|
|
|
|
reason = "who ever let humans program computers,
|
|
|
|
we're apparently really bad at it",
|
2019-12-21 05:16:18 -06:00
|
|
|
issue = "none")]
|
2018-05-19 19:19:20 -05:00
|
|
|
|
|
|
|
#![feature(staged_api)]
|
|
|
|
|
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2019-12-21 05:16:18 -06:00
|
|
|
#[rustc_const_unstable(feature="foo", issue = "none")]
|
2018-05-19 19:19:20 -05:00
|
|
|
const fn foo() -> u32 { 42 }
|
|
|
|
|
|
|
|
fn meh() -> u32 { 42 }
|
|
|
|
|
|
|
|
const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn
|
|
|
|
|
|
|
|
fn a() {
|
2019-04-22 02:40:08 -05:00
|
|
|
let _: &'static u32 = &foo(); //~ ERROR temporary value dropped while borrowed
|
2018-05-19 19:19:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-04-22 02:40:08 -05:00
|
|
|
let _: &'static u32 = &meh(); //~ ERROR temporary value dropped while borrowed
|
2018-05-19 19:19:20 -05:00
|
|
|
let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR temporary value dropped while borrowed
|
2018-05-19 19:19:20 -05:00
|
|
|
}
|