summaryrefslogtreecommitdiffstats
path: root/tests/ui/implied-bounds/issue-110161.rs
blob: e52c8356b52b3171b9f2f8d7400852e96fc1ec69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ICE regression relating to unconstrained lifetimes in implied
// bounds. See #110161.

// compile-flags: --crate-type=lib

trait LtTrait {
    type Ty;
}

// erroneous `Ty` impl
impl LtTrait for () {
//~^ ERROR not all trait items implemented, missing: `Ty` [E0046]
}

// `'lt` is not constrained by the erroneous `Ty`
impl<'lt, T> LtTrait for Box<T>
where
    T: LtTrait<Ty = &'lt ()>,
{
    type Ty = &'lt ();
}

// unconstrained lifetime appears in implied bounds
fn test(_: <Box<()> as LtTrait>::Ty) {}

fn test2<'x>(_: &'x <Box<()> as LtTrait>::Ty) {}