-
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
E0191: "help: specify the associated type" suggested where this would be wrong #91997
Comments
I think it gets evaluated as an expression because you are missing a trait MyIterator : Iterator {}
fn main() {
let _ = MyIterator::<Item=()>::next;
}
|
I see, let me rephrase the issue: The suggestion is "help: specify the associated type: |
Triage: Suggestion is correct for code using |
@rustbot claim |
Working on tests before creating a PR. Multiple tests exist already that have an odd hardcoded expectation for error output, so I'll be double checking those make sense with these changes, and adding a few tests of my own. Otherwise, this really does seem like it was a simple two character fix, unless I missed something somewhere. |
Yeah, it's a pretty easy one. Adding
Omitting //@ edition: 2015
trait MyIterator: Iterator {}
fn main() {
let _: MyIterator::Item;
}
|
Rollup merge of rust-lang#127094 - Borgerr:E0191-suggestion-correction, r=fmease E0191 suggestion correction, inserts turbofish closes rust-lang#91997
Given the following code: play
The current output is:
But when when I write
let _ = MyIterator<Item=()>::next;
, it gets interpreted as comparison expressions like(MyIterator < Item) = (() > ::next)
and it fails to compile with a lot of "cannot find valueItem
in this scope" and "cannot find cratenext
in the list of imported crates". The suggestion is confusing because it is unclear how to apply it.The error goes away if you use
Iterator
directly:let _ = Iterator::next;
produces the error one would expect:The text was updated successfully, but these errors were encountered: