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

associated type not normalized when a where-clause is present #28895

Open
arielb1 opened this Issue Oct 7, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@arielb1
Copy link
Contributor

arielb1 commented Oct 7, 2015

Affected Versions

At least 1.3, 1.4, rustc 1.5.0-nightly (11a612795 2015-10-04)

STR

trait Foo { type Bar; }
impl<T> Foo for T { type Bar = u64; }
fn foo<T>() -> <T as Foo>::Bar
    where T: Foo // <- the code compiles if this is removed
{ 1 }
fn main() {}

Expected Result

the code should compile

Actual Result

<anon>:7:14: 7:15 error: mismatched types:
 expected `<T as Foo>::Bar`,
    found `_`
(expected associated type,
    found integral variable) [E0308]
<anon>:7     x = Some(1);
                      ^

cc @nikomatsakis

@arielb1 arielb1 added the A-traits label Oct 7, 2015

@arielb1

This comment has been minimized.

Copy link
Contributor Author

arielb1 commented Oct 7, 2015

The root cause is that selection picks the where-clause candidate over any impl candidate, and this does not allow projection to make progress. This looks to be hard to fix.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 8, 2015

Yes, this is to some extent a known limitation and the "expected result", but I would still classify it as a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.