-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE: Associated type referencing itself #20772
Comments
cc @nikomatsakis, @nick29581 didn't easily find a dup of this. |
Looks like I am hitting a similar issue. Repro: pub trait Foo<T> {
}
pub trait Bar : Send {
type A;
type B: Foo<Self::A>;
}
pub fn main() {} |
@carllerche your code compiles with cf636c2 |
I have a similar issue with: pub trait Resources {}
pub trait CommandBuffer {
type Resouces: Resources;
}
pub trait Device {
type CommandBuffer: CommandBuffer<Resources = Self::Resources>;
}
|
@bjz With the latest nightly, your example doesn't ICE, but errors instead: bjz.rs:10:51: 10:66 error: associated type `Resources` not found for type parameter `Self` [E0220]
bjz.rs:10 type CommandBuffer: CommandBuffer<Resources = Self::Resources>;
^~~~~~~~~~~~~~~
bjz.rs:10:39: 10:67 error: no associated type `Resources` defined in `CommandBuffer` [E0218]
bjz.rs:10 type CommandBuffer: CommandBuffer<Resources = Self::Resources>;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors |
So that would be wrong...? Should I make a new issue? |
@bjz Why would that be wrong? |
Oh, woops - the example was meant to be: pub trait Resources {}
pub trait CommandBuffer {
type Resources: Resources;
}
pub trait Device {
type Resources: Resources;
type CommandBuffer: CommandBuffer<Resources = Self::Resources>;
} |
@bjz that compiles with the latest nightly ( |
Yay! |
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Closes rust-lang#20772 Closes rust-lang#20939 Closes rust-lang#21950 Closes rust-lang#22034
Compiling the above (admittedly ill-typed) file will cause
My version is
The text was updated successfully, but these errors were encountered: