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

idiom lints for removing extern crate #50260

Merged
merged 2 commits into from
May 8, 2018

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Apr 26, 2018

Based off of #49789

This contains two lints:

  • One that suggests replacing pub extern crates with pub use, and removing non-pub extern crates entirely
  • One that suggests rewriting use modulename::...::cratename::foo as cratename::foo

The latter is a bit tricky to emit suggestions for; for one this involves splicing spans (never a good idea), and it also won't be able to correctly
handle use module::{cratename, foo} and use-trees. I'm not sure how to proceed here. Currently it doesn't suggest anything at all.

Perhaps we can go the other way and suggest removal of all extern crates except those used through modules (stash node ids somewhere) and suggest replacing those with <visibility> use?

r? @nikomatsakis

fixes #48719

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2018
@Manishearth Manishearth mentioned this pull request Apr 26, 2018
5 tasks
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/26/a5/981fcedb0cba5cd167382878c92956229d14f0ac6846c71f2cd87906d474/awscli-1.15.10-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 9.0MB/s eta 0:00:01
    1% |▌                               | 20kB 1.8MB/s eta 0:00:01
    2% |▉                               | 30kB 2.1MB/s eta 0:00:01
    3% |█                               | 40kB 1.9MB/s eta 0:00:01
---
  Downloading https://files.pythonhosted.org/packages/b7/8e/ddb32ddaabd431813e180ca224e844bab8ad42fbb47ee07553f0ec44cd86/colorama-0.3.7-py2.py3-none-any.whl
Collecting botocore==1.10.10 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/77/c9/a40ebce24bbab4c7986fccdac9dade097385ad2feae73dcc47d31a1b4dc8/botocore-1.10.10-py2.py3-none-any.whl (4.2MB)
    0% |                                | 10kB 40.9MB/s eta 0:00:01
    0% |▏                               | 20kB 37.8MB/s eta 0:00:01
    0% |▎                               | 30kB 43.9MB/s eta 0:00:01
    0% |▎                               | 40kB 20.0MB/s eta 0:00:01
---

[00:04:49] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:49] tidy error: /checkout/src/librustc_lint/builtin.rs: too many trailing newlines (3)
[00:04:50] some tidy checks failed
[00:04:50] 
[00:04:50] 
[00:04:50] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:50] 
[00:04:50] 
[00:04:50] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:50] Build completed unsuccessfully in 0:01:58
[00:04:50] Build completed unsuccessfully in 0:01:58
[00:04:50] Makefile:79: recipe for target 'tidy' failed
[00:04:50] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:14991358
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/26/a5/981fcedb0cba5cd167382878c92956229d14f0ac6846c71f2cd87906d474/awscli-1.15.10-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 9.7MB/s eta 0:00:01
    1% |▌                               | 20kB 1.7MB/s eta 0:00:01
    2% |▉                               | 30kB 2.0MB/s eta 0:00:01
    3% |█                               | 40kB 1.9MB/s eta 0:00:01
---
  Downloading https://files.pythonhosted.org/packages/b7/8e/ddb32ddaabd431813e180ca224e844bab8ad42fbb47ee07553f0ec44cd86/colorama-0.3.7-py2.py3-none-any.whl
Collecting botocore==1.10.10 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/77/c9/a40ebce24bbab4c7986fccdac9dade097385ad2feae73dcc47d31a1b4dc8/botocore-1.10.10-py2.py3-none-any.whl (4.2MB)
    0% |                                | 10kB 44.1MB/s eta 0:00:01
    0% |▏                               | 20kB 27.3MB/s eta 0:00:01
    0% |▎                               | 30kB 32.5MB/s eta 0:00:01
    0% |▎                               | 40kB 13.9MB/s eta 0:00:01
---
[00:56:50] ......i....................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:56:54] .........
[00:57:28] ....................................................................................................
[00:57:57] .......................................................................ii...........................
[00:58:50] ...................................i....................................................i.ii......test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:59:36] ................................................................................................iiii
[01:00:03] iii.................................................................................................
[01:00:33] ....................................................................................................
[01:00:59] ....................................................................................................
---
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:35:10] 
[01:35:10] running 183 tests
[01:35:58] .................................................F..................................................
[01:36:47] ..................................................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
n-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu  ep-vec.rs
[01:37:56] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu  basic.rs --extern ep_lib=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu/libep_lib.rlib
[01:37:56] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-prelude.stage2-x86_64-unknown-linux-gnu:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown    |
[01:37:56] 
[01:37:56] 
[01:37:56] error[E0599]: no method named `internal` found for type `ep_lib::S` in the current scope
[01:37:56]   --> inner-mod.rs:18:7
[01:37:56]    |
[01:37:56] 18 |     s.internal(); // OK
[01:37:56]    |
[01:37:56]    |
[01:37:56]    = help: did you mean `external`?
[01:37:56] error: aborting due to previous error
[01:37:56] 
[01:37:56] For more information about this error, try `rustc --explain E0599`.
[01:37:56] For more information about this error, try `rustc --explain E0599`.
[01:37:56] make[1]: *** [all] Error 101
[01:37:56] ------------------------------------------
[01:37:56] 
[01:37:56] 
[01:37:56] thread '[run-make] run-make-fulldeps/extern-prelude' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2963:9
[01:37:56] 
[01:37:56] 
[01:37:56] failures:
[01:37:56]     [run-make] run-make-fulldeps/extern-prelude
[01:37:56]     [run-make] run-make-fulldeps/extern-prelude
[01:37:56] 
[01:37:56] test result: FAILED. 182 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:37:56] 
[01:37:56] 
[01:37:56] 
[01:37:56] 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" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/run-make-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-make" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -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" "3.9.1\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfinfo codegen core coverage debuginfocodeview debuginfodwarf debuginfopdb engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo "$RUN_SCRIPT"" exited with 2.
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Apr 27 01:05:14 UTC 2018
Fri, 27 Apr 2018 01:05:14 GMT
travis_time:end:002f1778:start=1524791114756601316,finish=1524791114829162918,duration=72561602

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)

@alexreg
Copy link
Contributor

alexreg commented Apr 28, 2018

I don't see why the second lint is problematic to implement. Could you elaborate?

@Manishearth
Copy link
Member Author

The path could be part of a larger path like use module::foo::bar::{cratename, baz}.

Also, we don't have a way of getting the span information of "this path up to this segment", we have to add and subtract spans for this (which is super fragile)

@Manishearth
Copy link
Member Author

To be clear, the lint itself is easy to do (it's implemented already), it's the suggestion that's tricky

@bors
Copy link
Contributor

bors commented May 1, 2018

☔ The latest upstream changes (presumably #49789) made this pull request unmergeable. Please resolve the merge conflicts.

@alexreg
Copy link
Contributor

alexreg commented May 1, 2018

Ahh, I see. Well, maybe a vague lint for now would be the best approach?

@Manishearth
Copy link
Member Author

@alexreg edition stuff must have suggestions.

But we're actually ditching that part of the lint anyway, so this isn't a problem anymore.

@nikomatsakis
Copy link
Contributor

So @aturon and I sketched out a migration plan in this paper document here. I'm trying to figure out how this PR relates to that.

}
let mut err = cx.struct_span_lint(UNNECESSARY_EXTERN_CRATE,
it.span, "`extern crate` is unnecessary in the new edition");
if it.vis == hir::Visibility::Public {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably watch out for #[macro_use] here.

There are also a number of corner cases that I suppose we ought to document (eg., in a migration guide). It might be nice if we used a diagnostic code or maybe just pointed users at the document once it becomes available. (e.g., "what do I do if extern crate is used to ensure linking but not otherwise used?" etc)

err.span_suggestion(it.span, "use `pub use`",
format!("pub use {}", it.name));
}
err.emit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing that certainly differs from the doc that @aturon and I prepared is that we hoped to suggest removing extern crate entries entirely when we could.

@Manishearth
Copy link
Member Author

I'm going to defer making this lint bail on cases where the crate contains a module that shadows a crate since that's not so important for now. @alexreg woudl you be interested in working on this? I'll file a bug once I'm done.

@Manishearth
Copy link
Member Author

r? @nikomatsakis

Deferring that minor bit of the lint to later

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.

[00:10:09] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:10:09] tidy error: /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs: incorrect license
[00:10:09] tidy error: /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs: missing trailing newline
[00:10:11] some tidy checks failed
[00:10:11] 
[00:10:11] 
[00:10:11] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:10:11] 
[00:10:11] 
[00:10:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:10:11] Build completed unsuccessfully in 0:01:56
[00:10:11] Build completed unsuccessfully in 0:01:56
[00:10:11] Makefile:79: recipe for target 'tidy' failed
[00:10:11] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:3b0494b6
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@alexreg
Copy link
Contributor

alexreg commented May 4, 2018

@Manishearth Sure, I can have a stab at that.

@Manishearth Manishearth changed the title [WIP] idiom lints for removing extern crate idiom lints for removing extern crate May 4, 2018
@Manishearth
Copy link
Member Author

Actually I realized it may not be necessary (See comment discussion)

@alexreg
Copy link
Contributor

alexreg commented May 4, 2018

@Manishearth Didn't quite understand your reasoning. I still see the possibility of a clash with a module name.

@Manishearth
Copy link
Member Author

Can you give a concrete example?

@Manishearth
Copy link
Member Author

Note that we already have a fallback mechanism for inline paths. If you do foo::bar in an inline path it will search the local module for foo first, and then the crates.

@Manishearth Manishearth added the WG-epoch Working group: Epoch (2018) management label May 4, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:06:06] 
[01:06:06] ---- [ui] ui-fulldeps/unnecessary-extern-crate.rs stdout ----
[01:06:06]  diff of stderr:
[01:06:06] 
[01:06:06] 1 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:4:1
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:14:1
[01:06:06] 3    |
[01:06:06] 4 LL | extern crate alloc;
[01:06:06] 5    | ^^^^^^^^^^^^^^^^^^^ help: remove it
[01:06:06] 6    |
[01:06:06] 7 note: lint level defined here
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:1:9
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:11:9
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:11:9
[01:06:06] 9    |
[01:06:06] 10 LL | #![deny(unnecessary_extern_crate)]
[01:06:06] 
[01:06:06] 12 
[01:06:06] 12 
[01:06:06] 13 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:7:1
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:17:1
[01:06:06] 15    |
[01:06:06] 16 LL | extern crate alloc as x;
[01:06:06] 17    | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
[01:06:06] 18 
[01:06:06] 18 
[01:06:06] 19 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:13:1
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:23:1
[01:06:06] 21    |
[01:06:06] 22 LL | pub extern crate test as y;
[01:06:06] 23    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
[01:06:06] 24 
[01:06:06] 24 
[01:06:06] 25 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:16:1
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:26:1
[01:06:06] 27    |
[01:06:06] 28 LL | pub extern crate libc;
[01:06:06] 29    | ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc`
[01:06:06] 30 
[01:06:06] 30 
[01:06:06] 31 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:22:5
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:32:5
[01:06:06] 33    |
[01:06:06] 34 LL |     extern crate alloc;
[01:06:06] 35    |     ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
[01:06:06] 36 
[01:06:06] 36 
[01:06:06] 37 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:25:5
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:35:5
[01:06:06] 39    |
[01:06:06] 40 LL |     extern crate alloc as x;
[01:06:06] 41    |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
[01:06:06] 42 
[01:06:06] 42 
[01:06:06] 43 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:28:5
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:38:5
[01:06:06] 45    |
[01:06:06] 46 LL |     pub extern crate test;
[01:06:06] 47    |     ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test`
[01:06:06] 48 
[01:06:06] 48 
[01:06:06] 49 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:31:5
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:41:5
[01:06:06] 51    |
[01:06:06] 52 LL |     pub extern crate test as y;
[01:06:06] 53    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`
[01:06:06] 54 
[01:06:06] 54 
[01:06:06] 55 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:35:9
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:45:9
[01:06:06] 57    |
[01:06:06] 58 LL |         extern crate alloc;
[01:06:06] 59    |         ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`
[01:06:06] 60 
[01:06:06] 60 
[01:06:06] 61 error: `extern crate` is unnecessary in the new edition
[01:06:06] -   --> $DIR/unnecessary-extern-crate.rs:38:9
[01:06:06] +   --> $DIR/unnecessary-extern-crate.rs:48:9
[01:06:06] 63    |
[01:06:06] 64 LL |         extern crate alloc as x;
[01:06:06] 65    |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`
[01:06:06] 
[01:06:06] The actual stderr differed from the expected stderr.
[01:06:06] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/unnecessary-extern-crate.stderr
[01:06:06] To update references, run this command from build directory:
[01:06:06] To update references, run this command from build directory:
[01:06:06] /checkout/src/test/ui-fulldeps/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps' 'unnecessary-extern-crate.rs'
[01:06:06] error: 1 errors occurred comparing output.
[01:06:06] status: exit code: 101
[01:06:06] status: exit code: 101
[01:06:06] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/unnecessary-extern-crate.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-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-fulldeps/unnecessary-extern-crate.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[01:06:06] ------------------------------------------
[01:06:06] 
[01:06:06] ------------------------------------------
[01:06:06] stderr:
[01:06:06] stderr:
[01:06:06] ------------------------------------------
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":534,"byte_end":553,"line_start":14,"line_end":14,"column_start":1,"column_end":20,"is_primary":true,"text":[{"text":"extern crate alloc;","highlight_start":1,"highlight_end":20}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"lint level defined here","code":null,"level":"note","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":475,"byte_end":499,"line_start":11,"line_end":11,"column_start":9,"column_end":33,"is_primary":true,"text":[{"text":"#![deny(unnecessary_extern_crate)]","highlight_start":9,"highlight_end":33}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove it","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":534,"byte_end":553,"line_start":14,"line_end":14,"column_start":1,"column_end":20,"is_primary":true,"text":[{"text":"extern crate alloc;","highlight_start":1,"highlight_end":20}],"label":null,"suggested_replacement":"","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:14:1\n   |\nLL | extern crate alloc;\n   | ^^^^^^^^^^^^^^^^^^^ help: remove it\n   |\nnote: lint level defined here\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:11:9\n   |\nLL | #![deny(unnecessary_extern_crate)]\n   |         ^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":631,"byte_end":655,"line_start":17,"line_end":17,"column_start":1,"column_end":25,"is_primary":true,"text":[{"text":"extern crate alloc as x;","highlight_start":1,"highlight_end":25}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":631,"byte_end":655,"line_start":17,"line_end":17,"column_start":1,"column_end":25,"is_primary":true,"text":[{"text":"extern crate alloc as x;","highlight_start":1,"highlight_end":25}],"label":null,"suggested_replacement":"use alloc as x","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:17:1\n   |\nLL | extern crate alloc as x;\n   | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":769,"byte_end":796,"line_start":23,"line_end":23,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"pub extern crate test as y;","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `pub use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":769,"byte_end":796,"line_start":23,"line_end":23,"column_start":1,"column_end":28,"is_primary":true,"text":[{"text":"pub extern crate test as y;","highlight_start":1,"highlight_end":28}],"label":null,"suggested_replacement":"pub use test as y","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:23:1\n   |\nLL | pub extern crate test as y;\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":881,"byte_end":903,"line_start":26,"line_end":26,"column_start":1,"column_end":23,"is_primary":true,"text":[{"text":"pub extern crate libc;","highlight_start":1,"highlight_end":23}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `pub use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":881,"byte_end":903,"line_start":26,"line_end":26,"column_start":1,"column_end":23,"is_primary":true,"text":[{"text":"pub extern crate libc;","highlight_start":1,"highlight_end":23}],"label":null,"suggested_replacement":"pub use libc","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:26:1\n   |\nLL | pub extern crate libc;\n   | ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1004,"byte_end":1023,"line_start":32,"line_end":32,"column_start":5,"column_end":24,"is_primary":true,"text":[{"text":"    extern crate alloc;","highlight_start":5,"highlight_end":24}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1004,"byte_end":1023,"line_start":32,"line_end":32,"column_start":5,"column_end":24,"is_primary":true,"text":[{"text":"    extern crate alloc;","highlight_start":5,"highlight_end":24}],"label":null,"suggested_replacement":"use alloc","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:32:5\n   |\nLL |     extern crate alloc;\n   |     ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1116,"byte_end":1140,"line_start":35,"line_end":35,"column_start":5,"column_end":29,"is_primary":true,"text":[{"text":"    extern crate alloc as x;","highlight_start":5,"highlight_end":29}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1116,"byte_end":1140,"line_start":35,"line_end":35,"column_start":5,"column_end":29,"is_primary":true,"text":[{"text":"    extern crate alloc as x;","highlight_start":5,"highlight_end":29}],"label":null,"suggested_replacement":"use alloc as x","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:35:5\n   |\nLL |     extern crate alloc as x;\n   |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1233,"byte_end":1255,"line_start":38,"line_end":38,"column_start":5,"column_end":27,"is_primary":true,"text":[{"text":"    pub extern crate test;","highlight_start":5,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `pub use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1233,"byte_end":1255,"line_start":38,"line_end":38,"column_start":5,"column_end":27,"is_primary":true,"text":[{"text":"    pub extern crate test;","highlight_start":5,"highlight_end":27}],"label":null,"suggested_replacement":"pub use test","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:38:5\n   |\nLL |     pub extern crate test;\n   |     ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test`\n\n"}
[01:06:06] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:488:22
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1352,"byte_end":1379,"line_start":41,"line_end":41,"column_start":5,"column_end":32,"is_primary":true,"text":[{"text":"    pub extern crate test as y;","highlight_start":5,"highlight_end":32}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `pub use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1352,"byte_end":1379,"line_start":41,"line_end":41,"column_start":5,"column_end":32,"is_primary":true,"text":[{"text":"    pub extern crate test as y;","highlight_start":5,"highlight_end":32}],"label":null,"suggested_replacement":"pub use test as y","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:41:5\n   |\nLL |     pub extern crate test as y;\n   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1494,"byte_end":1513,"line_start":45,"line_end":45,"column_start":9,"column_end":28,"is_primary":true,"text":[{"text":"        extern crate alloc;","highlight_start":9,"highlight_end":28}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1494,"byte_end":1513,"line_start":45,"line_end":45,"column_start":9,"column_end":28,"is_primary":true,"text":[{"text":"        extern crate alloc;","highlight_start":9,"highlight_end":28}],"label":null,"suggested_replacement":"use alloc","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:45:9\n   |\nLL |         extern crate alloc;\n   |         ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc`\n\n"}
[01:06:06] {"message":"`extern crate` is unnecessary in the new edition","code":{"code":"unnecessary_extern_crate","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1618,"byte_end":1642,"line_start":48,"line_end":48,"column_start":9,"column_end":33,"is_primary":true,"text":[{"text":"        extern crate alloc as x;","highlight_start":9,"highlight_end":33}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"use `use`","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs","byte_start":1618,"byte_end":1642,"line_start":48,"line_end":48,"column_start":9,"column_end":33,"is_primary":true,"text":[{"text":"        extern crate alloc as x;","highlight_start":9,"highlight_end":33}],"label":null,"suggested_replacement":"use alloc as x","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `extern crate` is unnecessary in the new edition\n  --> /checkout/src/test/ui-fulldeps/unnecessary-extern-crate.rs:48:9\n   |\nLL |         extern crate alloc as x;\n   |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x`\n\n"}
[01:06:06] {"message":"aborting due to 10 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 10 previous errors\n\n"}
[01:06:06] ------------------------------------------
[01:06:06] 
[01:06:06] thread '[ui] ui-fulldeps/unnecessary-extern-crate.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2967:9
[01:06:06] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[01:06:06] test result: FAILED. 12 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:06:06] 
[01:06:06] 
[01:06:06] 
[01:06:06] 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-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps" "--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-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -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" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:06:06] 
[01:06:06] 
[01:06:06] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:06] Build completed unsuccessfully in 0:20:20
[01:06:06] Build completed unsuccessfully in 0:20:20
[01:06:06] make: *** [check] Error 1
[01:06:06] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:28bc55b0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@alexreg
Copy link
Contributor

alexreg commented May 4, 2018

@Manishearth Hmm, maybe you're right. If there is a name clash after this lint is applied, then there was still a name clash before.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me but I think there is some question as to whether it is better to replace extern crate with use -- I guess overall it is better, that much less to understand.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 7, 2018

📌 Commit 01791de has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2018
@bors
Copy link
Contributor

bors commented May 7, 2018

⌛ Testing commit 01791de with merge 7264c79...

bors added a commit that referenced this pull request May 7, 2018
idiom lints for removing `extern crate`

Based off of #49789

This contains two lints:

 - One that suggests replacing pub extern crates with pub use, and removing non-pub extern crates entirely
 - One that suggests rewriting `use modulename::...::cratename::foo` as `cratename::foo`

The latter is a bit tricky to emit suggestions for; for one this involves splicing spans (never a good idea), and it also won't be able to correctly
handle `use module::{cratename, foo}` and use-trees. I'm not sure how to proceed here. Currently it doesn't suggest anything at all.

Perhaps we can go the other way and suggest removal of all extern crates _except_ those used through modules (stash node ids somewhere) and suggest replacing those with `<visibility> use`?

r? @nikomatsakis

fixes #48719
@bors
Copy link
Contributor

bors commented May 7, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 7, 2018
@rust-highfive
Copy link
Collaborator

The job dist-x86_64-apple-alt 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.
[00:02:39]       Memory: 8 GB
[00:02:39]       Boot ROM Version: VMW71.00V.0.B64.1704110547
[00:02:39]       Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
[00:02:39]       SMC Version (system): 2.8f0
[00:02:39]       Serial Number (system): VMzSmZvXsph4
[00:02:39] 
[00:02:39] hw.ncpu: 4
[00:02:39] hw.byteorder: 1234
[00:02:39] hw.memsize: 8589934592
---
Preparing deploy
travis_fold:end:dpl.2
travis_fold:start:dpl.3
Deploying application
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rustc-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rustc-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}uploading "7264c79a1b43751df9f59954dc7092d35447e399/rustfmt-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-std-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}uploading "7264c79a1b43751df9f59954dc7092d35447e399/rustfmt-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-std-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-src-nightly.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-src-nightly.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-nightly-x86_64-apple-darwin.pkg" with {:content_type=>"application/octet-stream", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-analysis-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rust-analysis-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rls-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rls-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/cargo-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/cargo-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
/Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:81:in `abort_upload': multipart upload failed: Encountered a `SocketError` while attempting to connect to: (Aws::S3::MultipartUploadError)
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=1&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=3&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=4&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=5&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=6&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:70:in `upload_parts'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:44:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/file_uploader.rb:32:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/object.rb:252:in `upload_file'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/dpl-s3-1.9.6/lib/dpl/provider/s3.rb:99:in `block (2 levels) in upload_multithreaded'
failed to deploy
failed to deploy
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

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)

@rust-highfive
Copy link
Collaborator

The job dist-x86_64-apple-alt 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.
[00:02:39]       Memory: 8 GB
[00:02:39]       Boot ROM Version: VMW71.00V.0.B64.1704110547
[00:02:39]       Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
[00:02:39]       SMC Version (system): 2.8f0
[00:02:39]       Serial Number (system): VMzSmZvXsph4
[00:02:39] 
[00:02:39] hw.ncpu: 4
[00:02:39] hw.byteorder: 1234
[00:02:39] hw.memsize: 8589934592
---
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rls-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/rls-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/cargo-nightly-x86_64-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "7264c79a1b43751df9f59954dc7092d35447e399/cargo-nightly-x86_64-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
/Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:81:in `abort_upload': multipart upload failed: Encountered a `SocketError` while attempting to connect to: (Aws::S3::MultipartUploadError)
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=1&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=3&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=4&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=5&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds-alt/7264c79a1b43751df9f59954dc7092d35447e399/rust-docs-nightly-x86_64-apple-darwin.tar.gz?partNumber=6&uploadId=MrlFz57KdI4FgxkMWdusiZwScTak3ncY1krE8k02o9WJsYmbBQt92qKI3201l2rrnU5ggDIM3tfvS5XSIJJY7uNqMkQ5lBKncI5tAz.qz0GX_3cv.Qx0Sc9.lq5oMzVg
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
us-west-2
cn-north-1
cn-northwest-1
us-gov-west-1
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:70:in `upload_parts'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:44:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/file_uploader.rb:32:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.43/lib/aws-sdk-resources/services/s3/object.rb:252:in `upload_file'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/dpl-s3-1.9.6/lib/dpl/provider/s3.rb:99:in `block (2 levels) in upload_multithreaded'
failed to deploy
failed to deploy
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

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)

@alexreg
Copy link
Contributor

alexreg commented May 7, 2018

Either an ephemeral error or the "apple-alt" build server is down?

@Manishearth
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2018
@bors
Copy link
Contributor

bors commented May 8, 2018

⌛ Testing commit 01791de with merge 0da1a69...

bors added a commit that referenced this pull request May 8, 2018
idiom lints for removing `extern crate`

Based off of #49789

This contains two lints:

 - One that suggests replacing pub extern crates with pub use, and removing non-pub extern crates entirely
 - One that suggests rewriting `use modulename::...::cratename::foo` as `cratename::foo`

The latter is a bit tricky to emit suggestions for; for one this involves splicing spans (never a good idea), and it also won't be able to correctly
handle `use module::{cratename, foo}` and use-trees. I'm not sure how to proceed here. Currently it doesn't suggest anything at all.

Perhaps we can go the other way and suggest removal of all extern crates _except_ those used through modules (stash node ids somewhere) and suggest replacing those with `<visibility> use`?

r? @nikomatsakis

fixes #48719
@bors
Copy link
Contributor

bors commented May 8, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 0da1a69 to master...

@bors bors merged commit 01791de into rust-lang:master May 8, 2018
@Manishearth Manishearth deleted the no-extern-crate branch May 8, 2018 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. WG-epoch Working group: Epoch (2018) management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extern crate epoch lint for Path Clarity RFC (2126)
5 participants