2024-06-23 20:11:56 -05:00
|
|
|
// #124563
|
2024-05-05 16:41:08 -05:00
|
|
|
use std::marker::PhantomData;
|
|
|
|
|
|
|
|
pub trait Trait {}
|
|
|
|
|
|
|
|
pub trait Foo {
|
|
|
|
type Trait: Trait;
|
|
|
|
type Bar: Bar;
|
|
|
|
fn foo(&mut self);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct FooImpl<'a, 'b, A: Trait>(PhantomData<&'a &'b A>);
|
|
|
|
|
|
|
|
impl<'a, 'b, T> Foo for FooImpl<'a, 'b, T>
|
|
|
|
where
|
|
|
|
T: Trait,
|
|
|
|
{
|
|
|
|
type Trait = T;
|
2024-06-23 20:11:56 -05:00
|
|
|
type Bar = BarImpl<'a, 'b, T>; //~ ERROR lifetime bound not satisfied
|
2024-05-05 16:41:08 -05:00
|
|
|
|
|
|
|
fn foo(&mut self) {
|
2024-06-23 20:11:56 -05:00
|
|
|
self.enter_scope(|ctx| { //~ ERROR lifetime may not live long enough
|
|
|
|
BarImpl(ctx); //~ ERROR lifetime may not live long enough
|
2024-05-05 16:41:08 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a, 'b, T> FooImpl<'a, 'b, T>
|
|
|
|
where
|
|
|
|
T: Trait,
|
|
|
|
{
|
|
|
|
fn enter_scope(&mut self, _scope: impl FnOnce(&mut Self)) {}
|
|
|
|
}
|
|
|
|
pub trait Bar {
|
|
|
|
type Foo: Foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct BarImpl<'a, 'b, T: Trait>(&'b mut FooImpl<'a, 'b, T>);
|
|
|
|
|
|
|
|
impl<'a, 'b, T> Bar for BarImpl<'a, 'b, T>
|
|
|
|
where
|
|
|
|
T: Trait,
|
|
|
|
{
|
|
|
|
type Foo = FooImpl<'a, 'b, T>;
|
|
|
|
}
|
2024-06-23 20:11:56 -05:00
|
|
|
|
|
|
|
fn main() {}
|