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