Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRustc does not warn about `use` with paths incompatible with `uniform_paths` for edition 2018 #53797
Comments
orium
added
A-lint
C-future-compatibility
C-bug
A-rust-2018-preview
A-edition-2018-lints
labels
Aug 29, 2018
orium
referenced this issue
Aug 29, 2018
Closed
`cargo fix --edition` does not make the code compilable in rust 2018 if `uniform_paths` are enabled #5905
orium
added this to the Rust 2018 RC milestone
Sep 1, 2018
This comment has been minimized.
This comment has been minimized.
|
The error is emitted during name resolution: rust/src/librustc_resolve/resolve_imports.rs Lines 721 to 733 in ee73f80 To make this rustfix-able, we would want to reformulate the |
zackmdavis
referenced this issue
Sep 3, 2018
Closed
Rust 2018: `cargo fix` doesn't remove `extern crate` #53922
This comment has been minimized.
This comment has been minimized.
|
@zackmdavis That's not enough. What needs to happen is the canaries need to be injected in Rust 2015 before switching to Rust 2018, and that's where the correct suggestions can be generated, because we know what the user meant (in the working Rust 2015 code). I've been meaning to do this ever since I realized it's actually plausible with the way the canaries are implemented, because we can inject them in more situations, and provide different diagnostics. |
eddyb
self-assigned this
Sep 6, 2018
orium
referenced this issue
Sep 20, 2018
Merged
Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. #54403
orium
modified the milestones:
Rust 2018 RC,
Edition 2018 RC 2
Sep 22, 2018
aturon
added
I-nominated
T-compiler
labels
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
@eddyb what is the story with this one? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis I didn't get to it, but also I've started to doubt the idea of reusing canaries. |
This comment has been minimized.
This comment has been minimized.
|
Discussed at compiler team meeting. This seems important enough to resolve that it should remain on the RC2 milestone. |
petrochenkov
self-assigned this
Oct 18, 2018
This comment has been minimized.
This comment has been minimized.
|
I just tested this locally and the most important instance ( |
This comment has been minimized.
This comment has been minimized.
|
The example works now, as the |
This comment has been minimized.
This comment has been minimized.
|
Closing for now — the problem described in this issue is fixed, though there may be a more general bug (we should try to make a test case for that?). |
nikomatsakis
closed this
Oct 18, 2018
This comment has been minimized.
This comment has been minimized.
|
You can still reproduce this by having a local item (in the type/module namespace), with the same name, e.g. this triggers the error on the playground, on beta & nightly: extern crate rayon;
mod foo {
mod rayon {}
use rayon::Scope;
}I added |
This comment has been minimized.
This comment has been minimized.
|
OK, I'm going to re-open, but move to Rust 2018 Release milestone, since I think that we can probably address this with some targeted tweaks and it seems like it will not affect The Entire World. |
nikomatsakis
reopened this
Oct 18, 2018
This comment has been minimized.
This comment has been minimized.
|
BTW, there is discussion on Zulip and in particular starting around here we are talking about the new reproduction |
nikomatsakis
modified the milestones:
Edition 2018 RC 2,
Rust 2018 Release
Oct 18, 2018
petrochenkov
removed their assignment
Oct 25, 2018
This comment has been minimized.
This comment has been minimized.
|
removing old nomination tag. |
pnkfelix
removed
the
I-nominated
label
Oct 25, 2018
This comment has been minimized.
This comment has been minimized.
|
visited for T-compiler triage. Marking P-high, since it is on the 2018 Release milestone. |
pnkfelix
added
the
P-high
label
Nov 8, 2018
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov does your PR address this issue? |
This comment has been minimized.
This comment has been minimized.
No, it doesn't. |
This comment has been minimized.
This comment has been minimized.
|
I haven't added any new lints on 2015 edition (which is this issue about), only uniform path reimplementation on 2018 edition. |
This comment has been minimized.
This comment has been minimized.
|
I've updated the OP to reflect the current status here @nikomatsakis it sounds like on the discussion linked you had a strawman of how to fix this. Did you get a chance to test that out? Or is someone lined up to fix this perhaps in a different fashion? |
This comment has been minimized.
This comment has been minimized.
|
I do think this is plausible to fix with a "quick hack". I might try to pull it off today, though I'm not sure how important it is. The original example no longer applies, and it's not clear how common the pattern described above is in real code. |
This comment has been minimized.
This comment has been minimized.
|
I think I'd agree as well that this, while still a bug, is likely no longer edition-critical. Any opposition to removing it from the milestone and removing P-high? |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton sgtm, I didn't get to do any work on this today |
orium commentedAug 29, 2018
•
edited by alexcrichton
Updated Description:
This code generates no warnings when compiled with the 2015 edition:
but when compiled with the 2018 edition fails to compile:
Old Description
Rustc does not warn about
usewith paths incompatible withuniform_pathsfor edition 2018. This means that rustfix it will not fix your code for edition 2018.To reproduce create the following project:
Cargo.toml:src/lib.rs:If you run
cargo +nightly checkyou will not get any warning, which means that when you runcargo +nightly fix --editionnothing will change, but the code is not compilable in rust 2018. ChangeCargo.tomlto enable edition 2018 (by addingcargo-features = ["edition"]andpackage.edition = "2018") and runcargo +nightly build:cargo +nightly fix --editionshould have changed line 4 touse ::criterion::Criterion.Ref: Bug in cargo: rust-lang/cargo#5905