-
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
type parameters of trait functions and impl selection combine in confusing ways #5221
Comments
Or, since Rust has already diverged from C++ in this area, perhaps it's time to think of a less-hideous way to specify types at use sites. :) |
@bstrie sure, but how? ^^ |
Putting aside syntax for the moment, I still don't understand the error here. In the line:
what, exactly, is |
@bstrie: The |
Yes, we need to integrate type parameters into paths in a better way. |
Still a bug. Since this potentially involves changing syntax, I'm nominating for milestone 1, well-defined. |
accepted for well-defined milestone |
accepted for backwards-compatible milestone |
relative of #5527 |
triage bump |
This is done. |
Rustup to rust-lang#69366 changelog: none
It started with this error:
Which is confusing because the
init()
method is just defined on one type parameter.However if I change the line to
let platform: P = Platform::init::<P, D>();
it compiles, which is confusing for the same reasons.The cause for this is that you can specify the type of an trait impl by appending an
::<T>
to the call of an function like this:let is_foo = Platform::foo::<int>()
, which is fine as long as the function itself has no specific trait bounds. Combined though it's a mess, as it's not even clear in which order the parameters go.As the type selection really belongs to the trait, and not to an function of that trait, I propose that the syntax should get changed to
let platform = Platform::<P>::init::<D>()
.More linenoise, but at least it's not confusing.
The text was updated successfully, but these errors were encountered: