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