Skip to content
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

Partial substitution of trait associated types results in compiltion failure #48324

Open
alexbool opened this issue Feb 18, 2018 · 3 comments
Open
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexbool
Copy link
Contributor

Consider a following playground:

#![crate_type = "lib"]

trait A<X> {
}

trait B {
    type X;
    type A: A<Self::X>;
}

fn oops<T: B<X=String>>(_: &T) {
}

It fails to compile with

   Compiling playground v0.0.1 (file:///playground)
error[E0277]: the trait bound `<T as B>::A: A<std::string::String>` is not satisfied
  --> src/lib.rs:11:1
   |
11 | / fn oops<T: B<X=String>>(_: &T) {
12 | | }
   | |_^ the trait `A<std::string::String>` is not implemented for `<T as B>::A`
   |
   = help: consider adding a `where <T as B>::A: A<std::string::String>` bound
   = note: required by `B`

error: aborting due to previous error

error: Could not compile `playground`.

To learn more, run the command again with --verbose.
@stokhos stokhos added A-traits Area: Trait system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 19, 2018
@alexbool
Copy link
Contributor Author

cc @nikomatsakis (or I don't know exactly who might help with this)

@nikomatsakis
Copy link
Contributor

This is a normalization failure. I think the best way to fix this is moving towards lazy normalization (a move that is very much in progress).

@jkordish jkordish added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label May 6, 2018
@steveklabnik
Copy link
Member

Triage: no change directly, this still fails to compile. I believe the lazy normalization work is ongoing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants