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

Type checker depends on generic type bounds too aggressively #34024

Closed
eefriedman opened this issue Jun 1, 2016 · 4 comments
Closed

Type checker depends on generic type bounds too aggressively #34024

eefriedman opened this issue Jun 1, 2016 · 4 comments

Comments

@eefriedman
Copy link
Contributor

fn f<T>(t:T) -> Box<T> { t.into() } // accepted
fn f2<T: Into<u32>>(t:T) -> Box<T> { t.into() } // error
fn f3<T: Into<u32>>(t:T) -> Box<T> { <T as Into<Box<T>>>::into(t) } // accepted

This seems counterintuitive: adding the Into<u32> suppresses the other implementations of Into<...>.

@hanna-kruppe
Copy link
Contributor

Seems related or perhaps even identical to #24066

@Mark-Simulacrum
Copy link
Member

All three forms now compile, so I'm going to close.

@Mark-Simulacrum
Copy link
Member

Not again, I tested in the wrong directory. Re-opening....

@Mark-Simulacrum
Copy link
Member

I'm going to close this in favor of #24066. That contains the same problem (masking other impls with a where clause).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants