summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
blob: fe99fe3f3406882ee04c39d47219095a0f95dd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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);
}