-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
A-edition-2018Area: The 2018 editionArea: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![no_std]
#![feature(vec_spare_capacity)]
extern crate alloc;
I expected to see this happen: No warning, because removing the extern crate gives an error:
error[E0635]: unknown feature `vec_spare_capacity`
--> tmp.rs:2:12
|
2 | #![feature(vec_spare_capacity)]
| ^^^^^^^^^^^^^^^^^^
Instead, this happened:
error: unused extern crate
--> tmp.rs:2:1
|
2 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: remove it
|
= note: requested on the command line with `-D unused-extern-crates`
I think either the lint shouldn't fire or the compiler should somehow know the available feature gates ahead of time.
Meta
rustc --version --verbose
:
rustc 1.53.0-nightly (138fd56cf 2021-04-02)
binary: rustc
commit-hash: 138fd56cf9598b4bf016634c768dca128a83a5d7
commit-date: 2021-04-02
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0
Metadata
Metadata
Assignees
Labels
A-edition-2018Area: The 2018 editionArea: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.