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

Remove noisy suggestion of hash_map #72656

Conversation

ayushmishra2005
Copy link
Contributor

Removed import suggestion of std::collections::hash_map::HashMap
#72642

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 27, 2020
@tesuji
Copy link
Contributor

tesuji commented May 27, 2020

The stderr files are auto-generated. You might want to change Rust file instead.

@ayushmishra2005
Copy link
Contributor Author

The stderr files are auto-generated. You might want to change Rust file instead.

I am looking into it.

Copy link
Member

@davidtwco davidtwco left a 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:

let msg = format!("consider importing {} {}{}", determiner, kind, instead);

show_candidates takes a &[ImportSuggestion], which we can trace back to these lines:

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:

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.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 7'
Agent machine name: 'fv-az578'
Current agent version: '2.168.2'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/3e6531e3-faa6-45bb-8ab8-d0a4ee66b1dc.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72656/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72656/merge:refs/remotes/pull/72656/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
..............................................................................i..................... 1800/10247
.................................................................................................... 1900/10247
.................................................................................................i.. 2000/10247
i................................................................................................... 2100/10247
.......................................................................................iiiii........ 2200/10247
.................................................................................................... 2400/10247
.................................................................................................... 2500/10247
.................................................................................................... 2600/10247
.................................................................................................... 2700/10247
---
...............i...............i.................................................................... 5200/10247
.................................................................................................... 5300/10247
..............................................................i..................................... 5400/10247
.......................................................i............................................ 5500/10247
..................................................................ii.ii........i...i................ 5600/10247
.........i.......................................................................................... 5800/10247
.................i.................................................................................. 5900/10247
......................................................................ii............................ 6000/10247
.........i.......................................................................................... 6100/10247
.........i.......................................................................................... 6100/10247
.................................................................................................... 6200/10247
.................................................................................................... 6300/10247
...............................ii...i..ii...........i............................................... 6400/10247
.................................................................................................... 6600/10247
.................................................................................................... 6700/10247
.................................................................................................... 6700/10247
................................................................i..ii............................... 6800/10247
.................................................................................................... 7000/10247
.................................................................................................... 7100/10247
..................i................................................................................. 7200/10247
.................................................................................................... 7300/10247
---
.................................................................................................... 8200/10247
...........F........................................................................................ 8300/10247
.....................................................i.............................................. 8400/10247
.................................................................................................... 8500/10247
.......iiiiii.iiiiii.i.............................................................................. 8600/10247
.................................................................................................... 8800/10247
.................................................................................................... 8900/10247
.................................................................................................... 9000/10247
.................................................................................................... 9100/10247
---
35 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement/use_suggestion_placement.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args resolve/use_suggestion_placement.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/resolve/use_suggestion_placement.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/resolve/use_suggestion_placement/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---

error[E0412]: cannot find type `HashMap` in this scope
  --> /checkout/src/test/ui/resolve/use_suggestion_placement.rs:27:23
   |
LL |     type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find
   |
help: consider importing one of these items
   |
LL | use std::collections::HashMap;
---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:08:08
Build completed unsuccessfully in 1:08:08
== clock drift check ==
  local time: Wed May 27 15:57:49 UTC 2020
  network time: Wed, 27 May 2020 15:57:49 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72656/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72656/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3678) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@nikomatsakis
Copy link
Contributor

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 :)

@ayushmishra2005
Copy link
Contributor Author

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:

let msg = format!("consider importing {} {}{}", determiner, kind, instead);

show_candidates takes a &[ImportSuggestion], which we can trace back to these lines:

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:

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.

@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 hash_map is being inserted.

I also tried to check this function lookup_import_candidates.

@davidtwco
Copy link
Member

@ayushmishra2005 I've responded in this comment - feel free to follow-up questions, good luck!

@ayushmishra2005 ayushmishra2005 deleted the remove_noisy_suggestion branch June 3, 2020 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants