-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Associated types are not correctly computed (at least not at the right time) #28828
Comments
We don't normalize when expanding type aliases. We can't always normalize directly (because of late-bound regions) - maybe we should in |
I had hoped (and still hope) to address these sorts of issues via lazy normalization. Sadly we haven't made much progress on that front yet. |
Here's another (simpler?) example that I believe exhibits the same bug: trait Foo {
type Out;
}
impl Foo for () {
type Out = bool;
}
fn main() {
type Bool = <() as Foo>::Out;
let x: Bool = true; // Error E0308, mismatched types, expected <() as Foo>::Out
} |
@nikomatsakis, Has there been any progress on lazy normalization since your comment? Is there room for some mentored work on this? I've got experience with compilers and PL theory. I also wrote a C compiler in Rust for my final year project at university. I have noticed that there seem to be a few gnarly issues in the type checker that don't seem to be making progress, often related to associated types. Is this due to limitations in the original design of the type checker's unification implementation? Would a redesign be of greater benefit in the long run? |
This is mostly due to emphasis elsewhere. But there actually is On Thu, Jan 07, 2016 at 05:47:06AM -0800, Dylan Ede wrote:
|
Fixes rust-lang#27901. Fixes rust-lang#28828. Fixes rust-lang#38135. Fixes rust-lang#39363.
If I have an associated type that impls some trait or is some other known type, I can't treat it as so. Example (playpen link):
The type
BobAlso
is (or should be) just an alias forBob
, however when I try to call itsprint()
function, the compiler complains that there is noprint
for<Bob as DoNothing>::Output
without figuring out that that it isBob
.The text was updated successfully, but these errors were encountered: