-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remove noisy suggestion of hash_map #72656
Remove noisy suggestion of hash_map #72656
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The stderr files are auto-generated. You might want to change Rust file instead. |
I am looking into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this isn't enough to solve #72642. You've changed a stderr
file, which is the output from the compiler for a test, which we use to make sure the compiler's output hasn't changed - changing it only makes the test fail, it doesn't change the output of the compiler.
You can grep to find that the "consider importing one of these items" help is constructed here in show_candidates
:
rust/src/librustc_resolve/diagnostics.rs
Line 1498 in 0aa6751
let msg = format!("consider importing {} {}{}", determiner, kind, instead); |
show_candidates
takes a &[ImportSuggestion]
, which we can trace back to these lines:
rust/src/librustc_resolve/late/diagnostics.rs
Lines 213 to 223 in f93bb2a
let candidates = self | |
.r | |
.lookup_import_candidates(ident, ns, is_expected) | |
.drain(..) | |
.filter(|ImportSuggestion { did, .. }| { | |
match (did, res.and_then(|res| res.opt_def_id())) { | |
(Some(suggestion_did), Some(actual_did)) => *suggestion_did != actual_did, | |
_ => true, | |
} | |
}) | |
.collect::<Vec<_>>(); |
Going slightly deeper, lookup_import_candidates_from_module
constructs the list of import suggestions:
rust/src/librustc_resolve/diagnostics.rs
Lines 628 to 635 in 0aa6751
fn lookup_import_candidates_from_module<FilterFn>( | |
&mut self, | |
lookup_ident: Ident, | |
namespace: Namespace, | |
start_module: Module<'a>, | |
crate_name: Ident, | |
filter_fn: FilterFn, | |
) -> Vec<ImportSuggestion> |
You might consider experimenting with this function to de-duplicate the suggestions in some way if you're interested in addressing this issue.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Since this PR is presently empty, I'm going to close it for now -- @ayushmishra2005 feel free to re-open when it's ready for review :) |
@davidtwco Thanks for your comment. Since I am new to Rust, so I would need more mentorship. I am still not able to figure out what is causing this issue and where I also tried to check this function |
@ayushmishra2005 I've responded in this comment - feel free to follow-up questions, good luck! |
Removed import suggestion of
std::collections::hash_map::HashMap
#72642