rust/tests/ui/impl-trait/bivariant-lifetime-liveness.rs

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

16 lines
269 B
Rust
Raw Normal View History

2023-10-14 09:28:44 -05:00
//@ check-pass
// issue: 116794
// Uncaptured lifetimes should not be required to be live.
struct Invariant<T>(*mut T);
fn opaque<'a: 'a>(_: &'a str) -> Invariant<impl Sized> {
Invariant(&mut ())
}
fn main() {
let x = opaque(&String::new());
drop(x);
}