-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Compiler unable to apply trait bound #57905
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
As a side note, the following variation of the code does not compile (with the same errors): trait Example {
type Foo;
fn foo<T: AsRef<()>>(&self, t: T);
}
impl <A, B> Example for (A, B) where
A: Iterator<Item = u32>,
B: AsRef<A::Item>,
{
type Foo = ();
fn foo<T: AsRef<Self::Foo>>(&self, t: T) {}
} while the following compiles with no problems: trait Example {
type Foo;
fn foo<T: AsRef<()>>(&self, t: T);
}
impl <A, B> Example for (A, B) where
A: Iterator<Item = u32>,
B: AsRef<A::Item>,
{
type Foo = ();
fn foo<T: AsRef<()>>(&self, t: T) {}
} It almost seems that the compiler is not able to manage two associate types substitutions at the same time. I might try to give a look at the internals in the next days and see if I can find the actual problem. |
Current output:
|
It has been over a year, can you estimate when this will be fixed? |
Triage: current output:
|
Sorry for the vague title, please change. I have found a strange bug that is at the intersection of associated types, trait type parameters, and method type parameters.
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=8584b2c75acb51a8c6082b668649ad29
Commenting out line 10
B: AsRef<A::Item>
makes the program compile, or changing it toB: AsRef<u32>
makes it compile (even thoughA::Item
is au32
).The text was updated successfully, but these errors were encountered: