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