-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: migrating extern crate
with #[macro_use]
#52043
Comments
This commit adds a lint to the compiler to warn against the `#[macro_use]` directive as part of the `rust_2018_idioms` lint. This lint is turned off by default and is only enabled when the `use_extern_macros` feature is also enabled. The lint here isn't fully fleshed out as it's just a simple warning rather than suggestions of how to actually import the macro, but hopefully it's a good base to start from! cc rust-lang#52043
rustc: Lint against `#[macro_use]` in 2018 idioms This commit adds a lint to the compiler to warn against the `#[macro_use]` directive as part of the `rust_2018_idioms` lint. This lint is turned off by default and is only enabled when the `use_extern_macros` feature is also enabled. The lint here isn't fully fleshed out as it's just a simple warning rather than suggestions of how to actually import the macro, but hopefully it's a good base to start from! cc #52043
I can't tell what the status is here. We have a lint (landed in #52275) but as far as I can tell (playground) it does not fire. In fact, I get no warnings at all when using extern crate in Rust 2018, even with idiom lints enabled. Is that expected? (We do appear to have stabilized |
I don't think however that this needs to be a Rust 2018 RC2 blocker, since edition lints are not idiom enabled by default. |
Clearing from milestone. |
@nikomatsakis is there a specific team we can tag this with? |
I'm going to tag this with T-compiler, under the assumption that they will either address it or punt it to the appropriate other team. |
discussed at T-compiler meeting. @nikomatsakis says idiom lints are essentially "deferred". They want a working group focused on them; that, or T-compiler. But in any case, it doesn't need the nomination tag; we'll work our way through the queue of A-edition-2018-lints labelled things eventually unnominating. |
This seems to have fallen through the cracks, and hasn't been looked at in years. We should consider whether, at this point, we can safely upgrade this lint to at least |
The behavior seems to be: If you don't use any macros, you get a warning that If you do, the I agree with @joshtriplett that we should at least warn and explain that this is deprecated. |
Just to clarify (since this issue hasn't gotten updates and the dialogue from years past led me to think that the lint as-implemented as not working):
|
The migration issue is that
#[macro_use] extern crate foo;
beings macros into scope fromfoo
andextern crate
is unidiomatic in the 2018 edition.local_inner_macros
is the current solution but as discussed in #50911, we're not 100% that works.The text was updated successfully, but these errors were encountered: