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

Add suggestion for duplicated import. #57973

Merged
merged 1 commit into from Feb 5, 2019

Conversation

Projects
None yet
6 participants
@davidtwco
Copy link
Member

davidtwco commented Jan 29, 2019

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 29, 2019

r? @michaelwoerister

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

Show resolved Hide resolved src/test/ui/issues/issue-19498.stderr Outdated
Show resolved Hide resolved .../issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr Outdated
Show resolved Hide resolved src/test/ui/issues/issue-45829/import-self.stderr Outdated
Show resolved Hide resolved src/test/ui/issues/issue-45829/rename.stderr Outdated
Show resolved Hide resolved src/test/ui/issues/issue-56411.stderr Outdated
Show resolved Hide resolved src/test/ui/no-std-inject.stderr Outdated
| | ^^^^^^^^^^^^^^^^^^^^^-
| |_|____________________|
| | help: remove unnecessary import
| `derive_a` reimported here

This comment has been minimized.

@estebank

estebank Jan 29, 2019

Contributor

Great behavior, although we probably should make sure we keep the #[macro_use] in the remaining extern statement... (not necessary in this PR)

This comment has been minimized.

@davidtwco

davidtwco Jan 30, 2019

Author Member

I've changed this to prefer keeping imports with attributes.

This comment has been minimized.

@estebank

estebank Jan 31, 2019

Contributor

It didn't seem to work in this case, but only address if you have time.

@davidtwco davidtwco force-pushed the davidtwco:issue-52891 branch from 20d0eda to 1bf26e9 Jan 30, 2019

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Jan 30, 2019

r? @estebank if that's OK.

@estebank
Copy link
Contributor

estebank left a comment

LGTM, few nitpicks inline.

Show resolved Hide resolved src/test/ui/issues/issue-52891.stderr
Show resolved Hide resolved src/test/ui/issues/issue-45829/rename.stderr Outdated
Show resolved Hide resolved src/test/ui/issues/issue-45829/import-twice.stderr
Show resolved Hide resolved src/librustc_resolve/lib.rs
Show resolved Hide resolved src/librustc_resolve/lib.rs Outdated

@davidtwco davidtwco force-pushed the davidtwco:issue-52891 branch from 1bf26e9 to 2c83c30 Jan 31, 2019

Add suggestion for duplicated import.
This commit adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.

@davidtwco davidtwco force-pushed the davidtwco:issue-52891 branch from 2c83c30 to 1595163 Jan 31, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 31, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 31, 2019

📌 Commit 1595163 has been approved by estebank

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 31, 2019

⌛️ Testing commit 1595163 with merge 2e4c395...

bors added a commit that referenced this pull request Jan 31, 2019

Auto merge of #57973 - davidtwco:issue-52891, r=estebank
Add suggestion for duplicated import.

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
@bors

This comment was marked as resolved.

Copy link
Contributor

bors commented Feb 1, 2019

💔 Test failed - checks-travis

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Feb 1, 2019

The job arm-android of your PR failed on Travis (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.
[01:49:24] test string::test_str_clear ... ok
[01:49:24] test string::test_str_truncate ... ok
[01:49:24] test string::test_str_truncate_invalid_len ... ok
[01:49:24] test string::test_str_truncate_split_codepoint ... ok
[01:49:24] died due to signal 11
[01:49:24] 
[01:49:24] 
[01:49:24] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "arm-linux-androideabi" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--"
[01:49:24] expected success, got: exit code: 3
---
travis_time:end:10dc2ee7:start=1548983131463511807,finish=1548983131483215261,duration=19703454
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0334ebaa
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:11233f1a
travis_time:start:11233f1a
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:06c0c880
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@davidtwco

This comment has been minimized.

Copy link
Member Author

davidtwco commented Feb 4, 2019

@bors retry #55861

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 4, 2019

⌛️ Testing commit 1595163 with merge c666916...

bors added a commit that referenced this pull request Feb 4, 2019

Auto merge of #57973 - davidtwco:issue-52891, r=estebank
Add suggestion for duplicated import.

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 4, 2019

💔 Test failed - status-appveyor

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Feb 4, 2019

Wut

@bors retry

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 5, 2019

⌛️ Testing commit 1595163 with merge b2c6b8c...

bors added a commit that referenced this pull request Feb 5, 2019

Auto merge of #57973 - davidtwco:issue-52891, r=estebank
Add suggestion for duplicated import.

Fixes #52891.

This PR adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 5, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: estebank
Pushing b2c6b8c to master...

@bors bors merged commit 1595163 into rust-lang:master Feb 5, 2019

1 check passed

homu Test successful
Details

@davidtwco davidtwco deleted the davidtwco:issue-52891 branch Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment