rust/tests/ui/nll/issue-52213.rs

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

16 lines
282 B
Rust
Raw Normal View History

2018-07-10 17:11:59 -05:00
fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
2022-05-21 12:42:16 -05:00
match (&t,) {
2018-07-10 17:11:59 -05:00
((u,),) => u,
2022-04-01 12:13:25 -05:00
//~^ ERROR lifetime may not live long enough
2018-07-10 17:11:59 -05:00
}
}
fn main() {
let x = {
let y = Box::new((42,));
transmute_lifetime(&y)
};
println!("{}", x);
}