rust/tests/ui/implied-bounds/issue-110161.rs

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

27 lines
560 B
Rust
Raw Normal View History

// ICE regression relating to unconstrained lifetimes in implied
// bounds. See #110161.
// compile-flags: --crate-type=lib
2023-04-14 03:18:28 -05:00
trait LtTrait {
type Ty;
}
// erroneous `Ty` impl
2023-04-14 03:18:28 -05:00
impl LtTrait for () {
//~^ ERROR not all trait items implemented, missing: `Ty` [E0046]
}
// `'lt` is not constrained by the erroneous `Ty`
2023-04-14 03:18:28 -05:00
impl<'lt, T> LtTrait for Box<T>
where
2023-04-14 03:18:28 -05:00
T: LtTrait<Ty = &'lt ()>,
{
type Ty = &'lt ();
}
// unconstrained lifetime appears in implied bounds
2023-04-14 03:18:28 -05:00
fn test(_: <Box<()> as LtTrait>::Ty) {}
fn test2<'x>(_: &'x <Box<()> as LtTrait>::Ty) {}