Files
rust/src/test/ui/nll/issue-52213.rs

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

21 lines
438 B
Rust
Raw Normal View History

2022-05-21 13:42:16 -04:00
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
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,) {
//[base]~^ ERROR cannot infer an appropriate lifetime
2018-07-11 01:11:59 +03:00
((u,),) => u,
2022-05-21 13:42:16 -04:00
//[nll]~^ 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);
}