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

edition lint: migrating extern crate with #[macro_use] #52043

Open
nrc opened this issue Jul 4, 2018 · 6 comments
Open

edition lint: migrating extern crate with #[macro_use] #52043

nrc opened this issue Jul 4, 2018 · 6 comments
Labels
A-edition-2018-lints Area: lints supporting the 2018 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. L-macro_use_extern_crate Lint: macro_use_extern_crate T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nrc
Copy link
Member

nrc commented Jul 4, 2018

The migration issue is that #[macro_use] extern crate foo; beings macros into scope from foo and extern 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.

@nrc nrc added the A-edition-2018-lints Area: lints supporting the 2018 edition label Jul 4, 2018
@nrc nrc mentioned this issue Jul 4, 2018
15 tasks
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jul 12, 2018
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
bors added a commit that referenced this issue Jul 13, 2018
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
@nikomatsakis
Copy link
Contributor

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 use_extern_macros in #50911.)

@nikomatsakis
Copy link
Contributor

I don't think however that this needs to be a Rust 2018 RC2 blocker, since edition lints are not idiom enabled by default.

@nikomatsakis nikomatsakis removed this from the Edition 2018 RC 2 milestone Oct 17, 2018
@nikomatsakis
Copy link
Contributor

Clearing from milestone.

@pnkfelix
Copy link
Member

@nikomatsakis is there a specific team we can tag this with?
That, or can you remove the nomination? (Would the team be T-compiler, or is there a different group dedicated to idiom lints?)

@pnkfelix
Copy link
Member

pnkfelix commented Dec 6, 2018

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.

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 6, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Dec 6, 2018

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.

@Enselic Enselic added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Nov 19, 2023
@fmease fmease added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. L-macro_use_extern_crate Lint: macro_use_extern_crate and removed C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018-lints Area: lints supporting the 2018 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. L-macro_use_extern_crate Lint: macro_use_extern_crate T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants