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

unused_extern_crates lint trigged after return of extern crate syntax for non-Cargo crates (alloc, etc.) #54381

Closed
sanmai-NL opened this issue Sep 20, 2018 · 2 comments
Assignees
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition

Comments

@sanmai-NL
Copy link

sanmai-NL commented Sep 20, 2018

Fallout from #54116, which fixed the syntax for imports from extern crates, a temporary solution to #53166.

This code:

extern crate alloc;

Leads to an unused_extern_crates lint failure.

error: `extern crate` is not idiomatic in the new edition                                                                                     
  --> bla/src/lib.rs:31:1                                                                                                                 
   |                                                                                                                                          
31 | extern crate alloc;                                                                                                                      
   | ^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`                                                                                          
   |   
note: lint level defined here                                                                                                                 
  --> bla/src/lib.rs:15:5                                                                                                                 
   |                                                                                                                                          
15 |     unused,                                                                                                                              
   |     ^^^^^^                                                                                                                               
   = note: #[deny(unused_extern_crates)] implied by #[deny(unused)]                                                         

Meta

rustc 1.30.0-nightly (20dc0c507 2018-09-19)
@alexcrichton
Copy link
Member

@eddyb was #54116 merged without a solution of what to do for this in Cargo?

@eddyb
Copy link
Member

eddyb commented Sep 28, 2018

We should at least fix the lint so it doesn't trigger in the cases where use foo; doesn't work.

cc @rust-lang/lang

@eddyb eddyb self-assigned this Sep 28, 2018
bors added a commit that referenced this issue Sep 30, 2018
Don't lint non-extern-prelude extern crate's in Rust 2018.

Fixes #54381 by silencing the lint telling users to remove `extern crate` when `use` doesn't work.

r? @alexcrichton cc @petrochenkov @nikomatsakis @Centril
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