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

resolve: Turn the "non-empty glob must import something" error into a lint #65539

Merged
merged 3 commits into from
Oct 29, 2019

Conversation

traxys
Copy link
Contributor

@traxys traxys commented Oct 18, 2019

This fixes #62334 by changing the error to a lint warning the glob. I changed the test but I'm very unsure of what I did as I do not know how to correctly check for the warning

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2019
@fpoli
Copy link
Contributor

fpoli commented Oct 18, 2019

To update the test I think you only need to replace the //~ ERROR with //~ WARNING. The annotation syntax is documented in the rustc-guide: https://rust-lang.github.io/rustc-guide/tests/adding.html#error-annotations.

@petrochenkov
Copy link
Contributor

If the warning is not reported due to compilation being stopped too early, then the test can be split into two tests - one with errors and another with warnings only.

@traxys
Copy link
Contributor Author

traxys commented Oct 18, 2019

I will need to check this evening, When running rustc I see a warning but the test does pass if I just remove the //~ ERROR without looking for a warning.

@traxys
Copy link
Contributor Author

traxys commented Oct 18, 2019

I fixed the test but because the tests in import are run with -A unused I needed to add a #![warn(unused)], I don't know if it is the right thing to do

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 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.
2019-10-18T19:19:06.7369368Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-18T19:19:06.7593553Z ##[command]git config gc.auto 0
2019-10-18T19:19:06.7642316Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-18T19:19:06.7706270Z ##[command]git config --get-all http.proxy
2019-10-18T19:19:06.7854482Z ##[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/65539/merge:refs/remotes/pull/65539/merge
---
2019-10-18T19:24:50.3801883Z Successfully built 0e8cdefea362
2019-10-18T19:24:50.4785154Z Successfully tagged rust-ci:latest
2019-10-18T19:24:50.5057111Z Built container sha256:0e8cdefea362ba19ae027a75cad02b65a4bb6b30707257f0da8ea2492404256f
2019-10-18T19:24:50.5075892Z Uploading finished image to https://rust-lang-ci-sccache2.s3.amazonaws.com/docker/590c864a5f2335de0a8287407f9a96030510ec86a676b9b48333a6a037ff1c9ca74007b9ad184866d613750a3d2a1a88c9ad4e657c82d0b1a088ee62c541c4ca
2019-10-18T19:25:52.4288218Z upload failed: - to s3://rust-lang-ci-sccache2/docker/590c864a5f2335de0a8287407f9a96030510ec86a676b9b48333a6a037ff1c9ca74007b9ad184866d613750a3d2a1a88c9ad4e657c82d0b1a088ee62c541c4ca An error occurred (InvalidAccessKeyId) when calling the CreateMultipartUpload operation: The AWS Access Key Id you provided does not exist in our records.
2019-10-18T19:25:53.5985073Z [CI_JOB_NAME=x86_64-gnu-llvm-6.0]
2019-10-18T19:25:53.6020467Z == clock drift check ==
2019-10-18T19:25:53.6030327Z   local time: Fri Oct 18 19:25:53 UTC 2019
2019-10-18T19:25:53.8943870Z   network time: Fri, 18 Oct 2019 19:25:53 GMT
---
2019-10-18T19:29:08.2898981Z    Compiling serde_json v1.0.40
2019-10-18T19:29:10.1240476Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-10-18T19:29:21.9834085Z     Finished release [optimized] target(s) in 1m 31s
2019-10-18T19:29:21.9919159Z tidy check
2019-10-18T19:29:22.3954068Z tidy error: /checkout/src/test/ui/imports/reexports.rs:9: line longer than 100 chars
2019-10-18T19:29:24.2420077Z some tidy checks failed
2019-10-18T19:29:24.2420951Z Found 482 error codes
2019-10-18T19:29:24.2421280Z Found 0 error codes with no tests
2019-10-18T19:29:24.2421516Z Done!
2019-10-18T19:29:24.2421516Z Done!
2019-10-18T19:29:24.2421722Z 
2019-10-18T19:29:24.2421930Z 
2019-10-18T19:29:24.2423061Z 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"
2019-10-18T19:29:24.2423694Z 
2019-10-18T19:29:24.2423890Z 
2019-10-18T19:29:24.2449522Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-10-18T19:29:24.2449944Z Build completed unsuccessfully in 0:01:34
2019-10-18T19:29:24.2449944Z Build completed unsuccessfully in 0:01:34
2019-10-18T19:29:24.2478443Z == clock drift check ==
2019-10-18T19:29:24.2511295Z   local time: Fri Oct 18 19:29:24 UTC 2019
2019-10-18T19:29:24.3455777Z   network time: Fri, 18 Oct 2019 19:29:24 GMT
2019-10-18T19:29:24.3455867Z == end clock drift check ==
2019-10-18T19:29:25.6154767Z 
2019-10-18T19:29:25.6259765Z ##[error]Bash exited with code '1'.
2019-10-18T19:29:25.6302368Z ##[section]Starting: Checkout
2019-10-18T19:29:25.6304348Z ==============================================================================
2019-10-18T19:29:25.6304402Z Task         : Get sources
2019-10-18T19:29:25.6304465Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@petrochenkov
Copy link
Contributor

I needed to add a #![warn(unused)], I don't know if it is the right thing to do

Yep, that's the right thing to do.
You could use more specific warn(unused_imports) though.

@petrochenkov
Copy link
Contributor

r? @petrochenkov

This probably doesn't need a full FCP, but I'm still going to ping the lang team.
Before that I need to find the rationale for the existing behavior though (why is it an error), I remember it was discussed before.

@petrochenkov petrochenkov changed the title Fix #62334 resolve: Turn the "non-empty glob must import something" error into a lint Oct 18, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 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.
2019-10-18T21:59:50.1495189Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-18T21:59:50.1692384Z ##[command]git config gc.auto 0
2019-10-18T21:59:50.2080878Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-18T21:59:50.2126862Z ##[command]git config --get-all http.proxy
2019-10-18T21:59:50.2262121Z ##[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/65539/merge:refs/remotes/pull/65539/merge
---
2019-10-18T22:59:17.3651565Z .................................................................................................... 1600/9196
2019-10-18T22:59:22.4907872Z .................................................................................................... 1700/9196
2019-10-18T22:59:35.2704222Z .............................i...............i...................................................... 1800/9196
2019-10-18T22:59:42.7532032Z .................................................................................................... 1900/9196
2019-10-18T22:59:57.0780768Z ...................iiiii............................................................................ 2000/9196
2019-10-18T23:00:07.6775939Z .................................................................................................... 2200/9196
2019-10-18T23:00:10.2507729Z .................................................................................................... 2300/9196
2019-10-18T23:00:15.6469421Z .................................................................................................... 2400/9196
2019-10-18T23:00:37.6673870Z .................................................................................................... 2500/9196
---
2019-10-18T23:03:28.6006436Z ......................i...............i............................................................. 4800/9196
2019-10-18T23:03:39.7771893Z .................................................................................................... 4900/9196
2019-10-18T23:03:45.8946600Z .................................................................................................... 5000/9196
2019-10-18T23:03:56.1472837Z .................................................................................................... 5100/9196
2019-10-18T23:04:02.3933708Z ......................ii.ii......................................................................... 5200/9196
2019-10-18T23:04:12.6468204Z .................................................................................................... 5400/9196
2019-10-18T23:04:22.2332474Z ........................................................................................i........... 5500/9196
2019-10-18T23:04:30.0696953Z .................................................................................................... 5600/9196
2019-10-18T23:04:34.9225953Z .................................................................................................... 5700/9196
2019-10-18T23:04:34.9225953Z .................................................................................................... 5700/9196
2019-10-18T23:04:45.1388721Z .....................................................................................ii...i..ii..... 5800/9196
2019-10-18T23:05:10.5713715Z .................................................................................................... 6000/9196
2019-10-18T23:05:19.0609038Z .................................................................................................... 6100/9196
2019-10-18T23:05:23.5423793Z .................................................................................................... 6200/9196
2019-10-18T23:05:23.5423793Z .................................................................................................... 6200/9196
2019-10-18T23:05:36.8853132Z .......i..ii........................................................................................ 6300/9196
2019-10-18T23:05:55.8146586Z ...................................................................i................................ 6500/9196
2019-10-18T23:05:57.9151591Z .................................................................................................... 6600/9196
2019-10-18T23:06:00.3084034Z .........................................i.......................................................... 6700/9196
2019-10-18T23:06:04.1083308Z .................................................................................................... 6800/9196
---
2019-10-18T23:10:08.2137386Z 
2019-10-18T23:10:08.2138070Z ---- [ui] ui/imports/reexports.rs stdout ----
2019-10-18T23:10:08.2138310Z diff of stderr:
2019-10-18T23:10:08.2138431Z 
2019-10-18T23:10:08.2138777Z 1 error[E0364]: `foo` is private, and cannot be re-exported
2019-10-18T23:10:08.2139128Z -   --> $DIR/reexports.rs:8:17
2019-10-18T23:10:08.2139450Z +   --> $DIR/reexports.rs:10:17
2019-10-18T23:10:08.2139756Z 4 LL |         pub use super::foo;
2019-10-18T23:10:08.2139878Z 5    |                 ^^^^^^^^^^
2019-10-18T23:10:08.2139988Z 
2019-10-18T23:10:08.2140121Z 6    |
2019-10-18T23:10:08.2140121Z 6    |
2019-10-18T23:10:08.2140417Z 7 note: consider marking `foo` as `pub` in the imported module
2019-10-18T23:10:08.2140797Z -   --> $DIR/reexports.rs:8:17
2019-10-18T23:10:08.2141145Z +   --> $DIR/reexports.rs:10:17
2019-10-18T23:10:08.2141430Z 10 LL |         pub use super::foo;
2019-10-18T23:10:08.2141760Z 11    |                 ^^^^^^^^^^
2019-10-18T23:10:08.2141872Z 
2019-10-18T23:10:08.2141996Z 12 
2019-10-18T23:10:08.2141996Z 12 
2019-10-18T23:10:08.2142135Z 13 error[E0603]: module `foo` is private
2019-10-18T23:10:08.2142442Z -   --> $DIR/reexports.rs:30:15
2019-10-18T23:10:08.2142770Z +   --> $DIR/reexports.rs:34:15
2019-10-18T23:10:08.2142944Z 15    |
2019-10-18T23:10:08.2143631Z 16 LL |     use b::a::foo::S;
2019-10-18T23:10:08.2143942Z 
2019-10-18T23:10:08.2144085Z 18 
2019-10-18T23:10:08.2144085Z 18 
2019-10-18T23:10:08.2144234Z 19 error[E0603]: module `foo` is private
2019-10-18T23:10:08.2144637Z -   --> $DIR/reexports.rs:31:15
2019-10-18T23:10:08.2145031Z +   --> $DIR/reexports.rs:35:15
2019-10-18T23:10:08.2145220Z 21    |
2019-10-18T23:10:08.2145406Z 22 LL |     use b::b::foo::S as T;
2019-10-18T23:10:08.2145998Z 
2019-10-18T23:10:08.2146159Z 24 
2019-10-18T23:10:08.2146159Z 24 
2019-10-18T23:10:08.2146737Z 25 warning: A non-empty glob must import something with the glob's visibility
2019-10-18T23:10:08.2147143Z -   --> $DIR/reexports.rs:9:17
2019-10-18T23:10:08.2147475Z +   --> $DIR/reexports.rs:11:17
2019-10-18T23:10:08.2147785Z 28 LL |         pub use super::*;
2019-10-18T23:10:08.2147907Z 29    |                 ^^^^^^^^
2019-10-18T23:10:08.2148015Z 
2019-10-18T23:10:08.2148121Z 
2019-10-18T23:10:08.2148121Z 
2019-10-18T23:10:08.2148262Z The actual stderr differed from the expected stderr.
2019-10-18T23:10:08.2148808Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/reexports/reexports.stderr
2019-10-18T23:10:08.2149170Z To update references, rerun the tests and pass the `--bless` flag
2019-10-18T23:10:08.2149544Z To only update this specific test, also pass `--test-args imports/reexports.rs`
2019-10-18T23:10:08.2149838Z error: 1 errors occurred comparing output.
2019-10-18T23:10:08.2149977Z status: exit code: 1
2019-10-18T23:10:08.2149977Z status: exit code: 1
2019-10-18T23:10:08.2150689Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/imports/reexports.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/reexports" "-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/imports/reexports/auxiliary" "-A" "unused"
2019-10-18T23:10:08.2151363Z ------------------------------------------
2019-10-18T23:10:08.2151520Z 
2019-10-18T23:10:08.2151848Z ------------------------------------------
2019-10-18T23:10:08.2152016Z stderr:
2019-10-18T23:10:08.2152016Z stderr:
2019-10-18T23:10:08.2152327Z ------------------------------------------
2019-10-18T23:10:08.2152683Z error[E0364]: `foo` is private, and cannot be re-exported
2019-10-18T23:10:08.2153810Z    |
2019-10-18T23:10:08.2154283Z LL |         pub use super::foo; //~ ERROR cannot be re-exported
2019-10-18T23:10:08.2154480Z    |                 ^^^^^^^^^^
2019-10-18T23:10:08.2154633Z    |
2019-10-18T23:10:08.2154633Z    |
2019-10-18T23:10:08.2154806Z note: consider marking `foo` as `pub` in the imported module
2019-10-18T23:10:08.2155403Z    |
2019-10-18T23:10:08.2155793Z LL |         pub use super::foo; //~ ERROR cannot be re-exported
2019-10-18T23:10:08.2155982Z    |                 ^^^^^^^^^^
2019-10-18T23:10:08.2156117Z 
2019-10-18T23:10:08.2156117Z 
2019-10-18T23:10:08.2156293Z error[E0603]: module `foo` is private
2019-10-18T23:10:08.2157267Z    |
2019-10-18T23:10:08.2157267Z    |
2019-10-18T23:10:08.2157395Z LL |     use b::a::foo::S; //~ ERROR `foo`
2019-10-18T23:10:08.2157643Z 
2019-10-18T23:10:08.2157643Z 
2019-10-18T23:10:08.2157763Z error[E0603]: module `foo` is private
2019-10-18T23:10:08.2158487Z    |
2019-10-18T23:10:08.2158487Z    |
2019-10-18T23:10:08.2158621Z LL |     use b::b::foo::S as T; //~ ERROR `foo`
2019-10-18T23:10:08.2159043Z 
2019-10-18T23:10:08.2159043Z 
2019-10-18T23:10:08.2159391Z warning: A non-empty glob must import something with the glob's visibility
2019-10-18T23:10:08.2160232Z    |
2019-10-18T23:10:08.2160232Z    |
2019-10-18T23:10:08.2160613Z LL |         pub use super::*; //~ WARNING must import something with the glob's visibility [unused_imports]
2019-10-18T23:10:08.2160922Z    |
2019-10-18T23:10:08.2161054Z note: lint level defined here
2019-10-18T23:10:08.2161369Z   --> /checkout/src/test/ui/imports/reexports.rs:1:9
2019-10-18T23:10:08.2161543Z    |
---
2019-10-18T23:10:08.2171120Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-18T23:10:08.2171429Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-18T23:10:08.2187317Z 
2019-10-18T23:10:08.2188050Z 
2019-10-18T23:10:08.2191976Z 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-6.0/bin/FileCheck" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-10-18T23:10:08.2192726Z 
2019-10-18T23:10:08.2192754Z 
2019-10-18T23:10:08.2202560Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-18T23:10:08.2202638Z Build completed unsuccessfully in 1:03:39
2019-10-18T23:10:08.2202638Z Build completed unsuccessfully in 1:03:39
2019-10-18T23:10:08.2254076Z == clock drift check ==
2019-10-18T23:10:08.2268670Z   local time: Fri Oct 18 23:10:08 UTC 2019
2019-10-18T23:10:10.2802493Z   network time: == end clock drift check ==
2019-10-18T23:10:11.4344840Z 
2019-10-18T23:10:11.4469984Z ##[error]Bash exited with code '1'.
2019-10-18T23:10:11.4506563Z ##[section]Starting: Checkout
2019-10-18T23:10:11.4508301Z ==============================================================================
2019-10-18T23:10:11.4508357Z Task         : Get sources
2019-10-18T23:10:11.4508422Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Centril Centril added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Oct 19, 2019
@Centril
Copy link
Contributor

Centril commented Oct 19, 2019

This probably doesn't need a full FCP, but I'm still going to ping the lang team.

Nominated. :) We'll discuss the aspect of FCP/not & what we think. Having the rationale ready by then would be great.

@petrochenkov
Copy link
Contributor

So, I couldn't find where exactly we discussed this with jseyfried, but the logic behind this is that

  • What imports really do is 1) pattern matching and 2) filtering by visibility.
  • use prefix::foo matches all items named foo in the prefix, there may be from 0 to 3 of them of them due to multiple namespaces.
  • use prefix::* matches all items in the prefix, there may be from 0 to infinity of them.
  • use prefix::foo/use prefix::* then filter away items that are not visible from the import's location.
  • if use prefix::foo imports 0 items after the filtering, we report a "private item" or an "unresolverd import" error, which is user friendly, but doesn't precisely reflect what happens. Instead, we could import nothing and let use prefix::foo be an unused import, but that's less intuitive and also harmful for the import resolution convergence (we can make progress based on the "single import always introduces a name or produces an error" guarantee).
  • applying the same logic to glob imports we get this the "non-empty glob must import something" which is basically an equivalent of the "private item" errors for single imports.

TLDR: The error is reported by analogy with single imports.

However, this analogy doesn't give as much, and it also may be expected from single and glob imports to behave differently by analogy with e.g. regexps - .* can match an empty string, but foo cannot.
So we can abandon it and make glob imports that import nothing always be valid (but perhaps warned about).

@petrochenkov petrochenkov added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 19, 2019
@nikomatsakis
Copy link
Contributor

So we discussed this in the @rust-lang/lang meeting and felt generally 👍 on warning and not error, except that we were also kind of confused about exactly what scenario we're even talking about.

This is specifically referring to the case where:

  • there is a pub(V) use in module X
  • there are items that are visible to X, but they do not have visibility V
    • in which case, we currently get an error, but we would not give a warning

This all seems fine to us. However, there was one question we wanted clarification on, @petrochenkov. You wrote that the error in the case of an explicit import is helpful for ensuring convergence:

we can make progress based on the "single import always introduces a name or produces an error" guarantee

Presumably, this doesn't apply to globs?

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.

One minor nit (pre-existing, but hey)

src/librustc_resolve/resolve_imports.rs Outdated Show resolved Hide resolved
@traxys
Copy link
Contributor Author

traxys commented Oct 24, 2019

The only thing for wich I have not seen any response is the concern about the warning message, if it should not be changed to "all items are too private" or "no item is public enough"

@petrochenkov
Copy link
Contributor

@nikomatsakis

we can make progress based on the "single import always introduces a name or produces an error" guarantee
Presumably, this doesn't apply to globs?

Yes, it doesn't apply to globs.
For single imports we also know what name they introduce, for globs the knowledge about some unknown name being introduced is pretty useless.

Also, this error was introduced together with pub(path), and glob could introduce 0 names before that, and jseyfried didn't want to break them, so globs can introduce 0 names now as well, e.g.

mod m {}
use m::*;

fn main() {}

@petrochenkov
Copy link
Contributor

Disregard all my comments about progress, I misremembered what this error is about.
It's basically a "private-in-public" errror for globs, this kind of error can be relaxed and turned into a warning for single imports as well.

@petrochenkov petrochenkov removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Oct 26, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 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.
2019-10-27T23:58:30.3863084Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-27T23:58:30.4044754Z ##[command]git config gc.auto 0
2019-10-27T23:58:30.4129276Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-27T23:58:30.4182887Z ##[command]git config --get-all http.proxy
2019-10-27T23:58:30.4334099Z ##[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/65539/merge:refs/remotes/pull/65539/merge
---
2019-10-28T00:04:47.8549690Z    Compiling serde_json v1.0.40
2019-10-28T00:04:49.7220684Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-10-28T00:05:01.8196592Z     Finished release [optimized] target(s) in 1m 33s
2019-10-28T00:05:01.8282553Z tidy check
2019-10-28T00:05:02.2604233Z tidy error: /checkout/src/librustc_resolve/resolve_imports.rs:981: line longer than 100 chars
2019-10-28T00:05:04.2496682Z some tidy checks failed
2019-10-28T00:05:04.2500114Z Found 484 error codes
2019-10-28T00:05:04.2500624Z Found 0 error codes with no tests
2019-10-28T00:05:04.2500857Z Done!
2019-10-28T00:05:04.2500857Z Done!
2019-10-28T00:05:04.2501165Z 
2019-10-28T00:05:04.2501376Z 
2019-10-28T00:05:04.2502518Z 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"
2019-10-28T00:05:04.2503110Z 
2019-10-28T00:05:04.2503296Z 
2019-10-28T00:05:04.2508046Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-10-28T00:05:04.2508381Z Build completed unsuccessfully in 0:01:37
2019-10-28T00:05:04.2508381Z Build completed unsuccessfully in 0:01:37
2019-10-28T00:05:04.2559535Z == clock drift check ==
2019-10-28T00:05:04.2569354Z   local time: Mon Oct 28 00:05:04 UTC 2019
2019-10-28T00:05:04.3989670Z   network time: Mon, 28 Oct 2019 00:05:04 GMT
2019-10-28T00:05:04.3991324Z == end clock drift check ==
2019-10-28T00:05:06.4361308Z 
2019-10-28T00:05:06.4426518Z ##[error]Bash exited with code '1'.
2019-10-28T00:05:06.4462014Z ##[section]Starting: Checkout
2019-10-28T00:05:06.4463638Z ==============================================================================
2019-10-28T00:05:06.4463686Z Task         : Get sources
2019-10-28T00:05:06.4463744Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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-6.0 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.
2019-10-28T10:23:10.7717607Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-28T10:23:10.7998836Z ##[command]git config gc.auto 0
2019-10-28T10:23:10.8069081Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-28T10:23:10.8118987Z ##[command]git config --get-all http.proxy
2019-10-28T10:23:10.8255833Z ##[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/65539/merge:refs/remotes/pull/65539/merge
---
2019-10-28T11:14:56.4894084Z .................................................................................................... 1600/9259
2019-10-28T11:15:01.5640924Z .................................................................................................... 1700/9259
2019-10-28T11:15:12.2159670Z ..........................................................i...............i......................... 1800/9259
2019-10-28T11:15:18.8078605Z .................................................................................................... 1900/9259
2019-10-28T11:15:31.4098895Z ................................................iiiii............................................... 2000/9259
2019-10-28T11:15:40.7555804Z .................................................................................................... 2200/9259
2019-10-28T11:15:43.0228886Z .................................................................................................... 2300/9259
2019-10-28T11:15:46.2654448Z .................................................................................................... 2400/9259
2019-10-28T11:16:06.2008236Z .................................................................................................... 2500/9259
---
2019-10-28T11:18:37.2056074Z ..................................................i..............i.................................. 4800/9259
2019-10-28T11:18:44.9109902Z .................................................................................................... 4900/9259
2019-10-28T11:18:52.3853613Z .................................................................................................... 5000/9259
2019-10-28T11:18:57.8428591Z .................................................................................................... 5100/9259
2019-10-28T11:19:06.9094098Z ..................................................ii.ii...........i................................. 5200/9259
2019-10-28T11:19:15.3925602Z .................................................................................................... 5400/9259
2019-10-28T11:19:23.6137609Z .................................................................................................... 5500/9259
2019-10-28T11:19:30.4632772Z ....................i............................................................................... 5600/9259
2019-10-28T11:19:35.6711830Z .................................................................................................... 5700/9259
2019-10-28T11:19:35.6711830Z .................................................................................................... 5700/9259
2019-10-28T11:19:45.7942600Z .................................................................................................... 5800/9259
2019-10-28T11:19:56.5495021Z .....ii...i..ii...........i......................................................................... 5900/9259
2019-10-28T11:20:15.3431185Z .................................................................................................... 6100/9259
2019-10-28T11:20:19.0686682Z .................................................................................................... 6200/9259
2019-10-28T11:20:19.0686682Z .................................................................................................... 6200/9259
2019-10-28T11:20:31.0826401Z ........................i..ii....................................................................... 6300/9259
2019-10-28T11:20:48.5546285Z ..........................................................................................i......... 6500/9259
2019-10-28T11:20:50.5234327Z .................................................................................................... 6600/9259
2019-10-28T11:20:52.5664168Z .................................................................i.................................. 6700/9259
2019-10-28T11:20:55.2526578Z .................................................................................................... 6800/9259
---
2019-10-28T11:24:28.7981967Z 4 LL |         pub use super::foo;
2019-10-28T11:24:28.7982203Z 5    |                 ^^^^^^^^^^
2019-10-28T11:24:28.7982405Z 
2019-10-28T11:24:28.7982658Z 6    |
2019-10-28T11:24:28.7982889Z 7 note: consider marking `foo` as `pub` in the imported module
2019-10-28T11:24:28.7983515Z -   --> $DIR/reexports.rs:10:17
2019-10-28T11:24:28.7984143Z +   --> $DIR/reexports.rs:8:17
2019-10-28T11:24:28.7984726Z 10 LL |         pub use super::foo;
2019-10-28T11:24:28.7985009Z 11    |                 ^^^^^^^^^^
2019-10-28T11:24:28.7985224Z 
2019-10-28T11:24:28.7985462Z 12 
2019-10-28T11:24:28.7985462Z 12 
2019-10-28T11:24:28.7985718Z 13 error[E0603]: module `foo` is private
2019-10-28T11:24:28.7986214Z -   --> $DIR/reexports.rs:35:15
2019-10-28T11:24:28.7986775Z +   --> $DIR/reexports.rs:33:15
2019-10-28T11:24:28.7987115Z 15    |
2019-10-28T11:24:28.7987359Z 16 LL |     use b::a::foo::S;
2019-10-28T11:24:28.7987843Z 
2019-10-28T11:24:28.7988082Z 18 
2019-10-28T11:24:28.7988313Z 19 error[E0603]: module `foo` is private
2019-10-28T11:24:28.7988820Z -   --> $DIR/reexports.rs:36:15
2019-10-28T11:24:28.7988820Z -   --> $DIR/reexports.rs:36:15
2019-10-28T11:24:28.7989365Z +   --> $DIR/reexports.rs:34:15
2019-10-28T11:24:28.7989678Z 21    |
2019-10-28T11:24:28.7989953Z 22 LL |     use b::b::foo::S as T;
2019-10-28T11:24:28.7990400Z 
2019-10-28T11:24:28.7990659Z 24 
2019-10-28T11:24:28.7990659Z 24 
2019-10-28T11:24:28.7991178Z - warning: this glob doesn't reexport anything because no canditate is public enough
2019-10-28T11:24:28.7991731Z -   --> $DIR/reexports.rs:11:17
2019-10-28T11:24:28.7992356Z + warning: glob import doesn't reexport anything because no candidate is public enough
2019-10-28T11:24:28.7995421Z +   --> $DIR/reexports.rs:9:17
2019-10-28T11:24:28.7995636Z 28 LL |         pub use super::*;
2019-10-28T11:24:28.7995679Z 29    |                 ^^^^^^^^
2019-10-28T11:24:28.7995740Z 
2019-10-28T11:24:28.7995766Z 
2019-10-28T11:24:28.7995766Z 
2019-10-28T11:24:28.7995809Z The actual stderr differed from the expected stderr.
2019-10-28T11:24:28.7996199Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/reexports/reexports.stderr
2019-10-28T11:24:28.7996478Z To update references, rerun the tests and pass the `--bless` flag
2019-10-28T11:24:28.7996753Z To only update this specific test, also pass `--test-args imports/reexports.rs`
2019-10-28T11:24:28.7996852Z error: 1 errors occurred comparing output.
2019-10-28T11:24:28.7996895Z status: exit code: 1
2019-10-28T11:24:28.7996895Z status: exit code: 1
2019-10-28T11:24:28.7997543Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/imports/reexports.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/reexports" "-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/imports/reexports/auxiliary" "-A" "unused"
2019-10-28T11:24:28.7998059Z ------------------------------------------
2019-10-28T11:24:28.7998117Z 
2019-10-28T11:24:28.7998354Z ------------------------------------------
2019-10-28T11:24:28.7998401Z stderr:
2019-10-28T11:24:28.7998401Z stderr:
2019-10-28T11:24:28.7998625Z ------------------------------------------
2019-10-28T11:24:28.7998887Z error[E0364]: `foo` is private, and cannot be re-exported
2019-10-28T11:24:28.7999126Z   --> /checkout/src/test/ui/imports/reexports.rs:8:17
2019-10-28T11:24:28.7999177Z    |
2019-10-28T11:24:28.7999439Z LL |         pub use super::foo; //~ ERROR cannot be re-exported
2019-10-28T11:24:28.7999488Z    |                 ^^^^^^^^^^
2019-10-28T11:24:28.7999528Z    |
2019-10-28T11:24:28.7999590Z note: consider marking `foo` as `pub` in the imported module
2019-10-28T11:24:28.7999888Z    |
2019-10-28T11:24:28.8000140Z LL |         pub use super::foo; //~ ERROR cannot be re-exported
2019-10-28T11:24:28.8000191Z    |                 ^^^^^^^^^^
2019-10-28T11:24:28.8000220Z 
2019-10-28T11:24:28.8000220Z 
2019-10-28T11:24:28.8000260Z error[E0603]: module `foo` is private
2019-10-28T11:24:28.8000596Z   --> /checkout/src/test/ui/imports/reexports.rs:33:15
2019-10-28T11:24:28.8000655Z    |
2019-10-28T11:24:28.8000698Z LL |     use b::a::foo::S; //~ ERROR `foo`
2019-10-28T11:24:28.8000789Z 
2019-10-28T11:24:28.8000829Z error[E0603]: module `foo` is private
2019-10-28T11:24:28.8001098Z   --> /checkout/src/test/ui/imports/reexports.rs:34:15
2019-10-28T11:24:28.8001163Z    |
2019-10-28T11:24:28.8001163Z    |
2019-10-28T11:24:28.8001205Z LL |     use b::b::foo::S as T; //~ ERROR `foo`
2019-10-28T11:24:28.8001274Z 
2019-10-28T11:24:28.8001274Z 
2019-10-28T11:24:28.8001548Z warning: glob import doesn't reexport anything because no candidate is public enough
2019-10-28T11:24:28.8001855Z    |
2019-10-28T11:24:28.8001917Z LL |         pub use super::*;
2019-10-28T11:24:28.8001959Z    |                 ^^^^^^^^
2019-10-28T11:24:28.8001998Z    |
---
2019-10-28T11:24:28.8007429Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-28T11:24:28.8007491Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-28T11:24:28.8022344Z 
2019-10-28T11:24:28.8022450Z 
2019-10-28T11:24:28.8023937Z 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-6.0/bin/FileCheck" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-10-28T11:24:28.8024355Z 
2019-10-28T11:24:28.8024382Z 
2019-10-28T11:24:28.8030376Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-28T11:24:28.8030481Z Build completed unsuccessfully in 0:55:25
2019-10-28T11:24:28.8030481Z Build completed unsuccessfully in 0:55:25
2019-10-28T11:24:28.8078929Z == clock drift check ==
2019-10-28T11:24:28.8094543Z   local time: Mon Oct 28 11:24:28 UTC 2019
2019-10-28T11:24:29.0752668Z   network time: Mon, 28 Oct 2019 11:24:29 GMT
2019-10-28T11:24:29.0754735Z == end clock drift check ==
2019-10-28T11:24:30.3291334Z 
2019-10-28T11:24:30.3415267Z ##[error]Bash exited with code '1'.
2019-10-28T11:24:30.3450824Z ##[section]Starting: Checkout
2019-10-28T11:24:30.3453386Z ==============================================================================
2019-10-28T11:24:30.3453445Z Task         : Get sources
2019-10-28T11:24:30.3453492Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@nikomatsakis
Copy link
Contributor

@traxys the usual technique is to use git rebase -i and convert all but the first commit to "squash" (and then edit the message)

@eddyb
Copy link
Member

eddyb commented Oct 28, 2019

You can use fixup instead of squash if you don't want to concatenate the messages, btw (they're otherwise equivalent).

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 29, 2019

📌 Commit ed8585f has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 29, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 29, 2019
resolve: Turn the "non-empty glob must import something" error into a lint

This fixes rust-lang#62334 by changing the error to a lint warning the glob. I changed the test but I'm very unsure of what I did as I do not know how to correctly check for the warning
tmandry added a commit to tmandry/rust that referenced this pull request Oct 29, 2019
resolve: Turn the "non-empty glob must import something" error into a lint

This fixes rust-lang#62334 by changing the error to a lint warning the glob. I changed the test but I'm very unsure of what I did as I do not know how to correctly check for the warning
bors added a commit that referenced this pull request Oct 29, 2019
Rollup of 12 pull requests

Successful merges:

 - #65405 (Create new error E0742 and add long error explanation)
 - #65539 (resolve: Turn the "non-empty glob must import something" error into a lint)
 - #65724 (ci: refactor pr tools job skipping)
 - #65741 (Prevent help popup to disappear when clicking on it)
 - #65832 (Re-enable Emscripten's exception handling support)
 - #65843 (Enable dist for MIPS64 musl targets)
 - #65898 (add basic HermitCore support within libtest)
 - #65900 (proc_macro: clean up bridge::client::__run_expand{1,2} a bit.)
 - #65906 (Update mdbook to 0.3.3)
 - #65920 (Use rustc-workspace-hack for rustbook)
 - #65930 (doc: use new feature gate for c_void type)
 - #65936 (save-analysis: Account for async desugaring in async fn return types)

Failed merges:

 - #65434 (Add long error explanation for E0577)

r? @ghost
@bors bors merged commit ed8585f into rust-lang:master Oct 29, 2019
@pnkfelix pnkfelix added beta-nominated Nominated for backporting to the compiler in the beta channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 31, 2019
@pnkfelix
Copy link
Member

discussed in T-compiler meeting. Accepted for beta backport.

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Oct 31, 2019
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 1, 2019
bors added a commit that referenced this pull request Nov 2, 2019
[beta] backport rollup

* save-analysis: Account for async desugaring in async fn return types #65936
* resolve: Turn the "non-empty glob must import something" error into a lint #65539
* Updated RELEASES.md for 1.39.0 #64878 (squashed)
bors added a commit that referenced this pull request Nov 2, 2019
[beta] backport rollup

* save-analysis: Account for async desugaring in async fn return types #65936
* resolve: Turn the "non-empty glob must import something" error into a lint #65539
* Updated RELEASES.md for 1.39.0 #64878 (squashed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change "A non-empty glob must import something with the glob's visibility" to be a lint?