Closed
Description
pub trait Trait {
type FooFn<'a>: FnOnce() + 'a where Self: 'a;
fn foo(&mut self) -> Self::FooFn<'_>;
}
struct Thingy(u32);
impl Trait for &Thingy {
type FooFn<'a> = impl FnOnce() + 'a where Self: 'a;
fn foo(&mut self) -> Self::FooFn<'_> {
move || {
println!("{}", self.0);
}
}
}
fails with
error[E0700]: hidden type for `<&Thingy as Trait>::FooFn<'_>` captures lifetime that does not appear in bounds
--> src/lib.rs:16:9
|
13 | impl Trait for &Thingy {
| - hidden type `[closure@src/lib.rs:16:9: 16:16]` captures the anonymous lifetime as defined here
...
16 | / move || {
17 | | println!("{}", self.0);
18 | | }
| |_________^
while this used to work before. I think because the where Self: 'a
part takes care of the capture (?).
Not present in nightly yet, found it by building 1cbc459 from git master. Bisected it to 7fe6f36 which is #103491 @cjgillot
@rustbot label F-type_alias_impl_trait