-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
edition lint: modules shadowing extern crates #52040
Comments
So the issue is mod foo {
extern crate foo;
} Because in the 2018 edition mod foo {
use foo;
} Because that seems conflict free. Having both So I'm not sure what this issue is about |
mod serde;
use crate::serde::Serialize; This is I believe ambiguous as implemented today because of implicit prelude; both |
@Mark-Simulacrum I don't think there's an implicit prelude of |
The issue I believe is not that there is some inherent ambiguity -- e.g., with @Mark-Simulacrum's example, in fact, the A more interesting case is a case like this: mod serde;
mod foo {
// In Rust 2015, this comes from the module at crate root.
//
// In Rust 2018, this comes from the crate `serde` (presuming there is one), or otherwise
// is an error.
use serde::bar;
} I believe our fear was that we would sometimes make incorrect rewrite suggestions in the migration lints. I can think of a few possibilities. Incorrect useThis may not be an issue, actually, but the idea would be that you have a use like this which currently refers to the serde crate: mod serde;
mod bar {
extern crate serde;
use self::serde::Foo;
} If we were to try and rewrite this path to Outside of a useextern crate serde;
mod foo {
mod serde;
fn foo() -> ::serde::Foo { }
} I don't recall what kind of rewrites we do in these cases, but perhaps we would rewrite |
(On a related note, we will currently suggest removing |
@nikomatsakis I fear I'm left even more confused after reading your comment than before :( For your "incorrect use" example we don't currently lint anything starting with For the "outside of a use" example I'm not really sure what's going on, but we don't make any suggestions today. It sounds like this issue is mostly "if we get aggressive about suggestions we'll have problems", but I don't think we're that aggressive today? It's today just a pure "your code will stop compiling, please fix it" lint rather than "your code isn't idiomatic, please let me help you" lint |
This issue is not currently actionable. I've removed from the milestone but tagged for @rust-lang/lang team discussion. |
We do need to fix the edition lints and rustfix suggestions for the edition, especially with |
Nobody can tell what this was about. Maybe it doesn't apply. We're going to close it for now until we have some actionable bug. |
AFAIK, we don't have a plan for how to handle this. We should make one!
cc @rust-lang/compiler
The text was updated successfully, but these errors were encountered: