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

False positive for 2018 unused extern crate in global allocator #52483

Closed
Mark-Simulacrum opened this issue Jul 18, 2018 · 2 comments
Closed
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

Possibly macro related, not sure.

https://play.rust-lang.org/?gist=7c9846d22f310efa6ab4bec086d61d4e&version=nightly&mode=debug&edition=2018

#![deny(rust_2018_idioms)]

use alloc_system;

#[global_allocator]
static ALLOC: alloc_system::System = alloc_system::System;

fn main() {}
error: `extern crate` is not idiomatic in the new edition
 --> src/main.rs:6:1
  |
6 | static ALLOC: alloc_system::System = alloc_system::System;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
  |
note: lint level defined here
 --> src/main.rs:1:9
  |
1 | #![deny(rust_2018_idioms)]
  |         ^^^^^^^^^^^^^^^^
  = note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)]

cc @alexcrichton

@Mark-Simulacrum Mark-Simulacrum added the A-edition-2018-lints Area: Lints supporting the 2018 edition label Jul 18, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Jul 18, 2018

Possibly solved by #52467

If not, the function introduced in that PR can be used to solve this

@alexcrichton
Copy link
Member

I've confirmed this is fixed by #52467

bors added a commit that referenced this issue Jul 20, 2018
Squash all lints tied to foreign macros by default

This PR is a continuation of #49755 (thanks for the initial jump-start @Dylan-DPC!) and is targeted at solving #48855. This change updates the lint infrastructure to, by default, ignore all lints emitted for code that originates in a foreign macro. For example if `println!("...")` injects some idiomatic warnings these are all ignored by default. The rationale here is that for almost all lints there's no action that can be taken if the code originates from a foreign lint.

Closes #48855
Closes #52483
Closes #52479
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
Projects
None yet
Development

No branches or pull requests

3 participants