You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trait Aaa: Sized where
for<'a> &'a Self: AaaLt<'a, Self>
{}
trait AaaLt<'a, A: Aaa> where
for<'b> &'b A: AaaLt<'b, A>
{
type View;
}
trait AaaPlus: Aaa where
for<'a> &'a Self: AaaLt<'a, Self>,
for<'a> <&'a Self as AaaLt<'a, Self>>::View: Bbb
{}
trait Bbb {
}
struct Foo<'a> {
x: &'a usize
}
impl<'a> Bbb for Foo<'a> {
}
struct Bar {
}
impl Aaa for Bar {
}
impl<'a> AaaLt<'a, Bar> for &'a Bar {
type View = Foo<'a>;
}
impl AaaPlus for Bar {
}
with error: the trait bound for<'a> <&'a dirty::Bar as dirty::AaaLt<'a, dirty::Bar>>::View: dirty::Bbb is not satisfied.
What I am trying to do is the following. I want to have a marker trait Aaa that defines some associated types. One of those associated types View have lifetime parameters. But generic associated types are not currently allowed in stable Rust, so I define them as types associated to a lifetime-parameterized trait that every reference must satisfy; I use a higher-rank trait bound for this purpose.
For a specialization of the trait Aaa called AaaPlus, (each instantiation of) the type View must satisfy some other trait Bbb. Despite the corresponding traits being implemented for Bar: AaaPlus and Foo<'a>: Bbb, Rust is failing to typecheck this.
The text was updated successfully, but these errors were encountered:
Rust fails to typecheck the following code:
with error: the trait bound
for<'a> <&'a dirty::Bar as dirty::AaaLt<'a, dirty::Bar>>::View: dirty::Bbb
is not satisfied.What I am trying to do is the following. I want to have a marker trait
Aaa
that defines some associated types. One of those associated typesView
have lifetime parameters. But generic associated types are not currently allowed in stable Rust, so I define them as types associated to a lifetime-parameterized trait that every reference must satisfy; I use a higher-rank trait bound for this purpose.For a specialization of the trait
Aaa
calledAaaPlus
, (each instantiation of) the typeView
must satisfy some other traitBbb
. Despite the corresponding traits being implemented forBar: AaaPlus
andFoo<'a>: Bbb
, Rust is failing to typecheck this.The text was updated successfully, but these errors were encountered: