-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.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
When implementing #52644, where we emit errors when using unknown features, I had to special case two features: libc
and test
, because they weren't being picked up (and there were time constraints).
The special-casing is here:
rust/src/librustc/middle/stability.rs
Lines 840 to 847 in 0aa8d03
// `stdbuild` has special handling for `libc`, so we need to | |
// recognise the feature when building std. | |
// Likewise, libtest is handled specially, so `test` isn't | |
// available as we'd like it to be. | |
// FIXME: only remove `libc` when `stdbuild` is active. | |
// FIXME: remove special casing for `test`. | |
remaining_lib_features.remove(&Symbol::intern("libc")); | |
remaining_lib_features.remove(&Symbol::intern("test")); |
libc
is declared unlike any other feature:
https://github.com/rust-lang/libc/blob/6bdbf5dc937459bd10e6bc4dc52b0adbd8cf4358/src/lib.rs#L92-L94
so it's not entirely surprising that the detection overlooks it, but I didn't find the root cause.- I didn't manage to figure out what makes
test
special.
Ideally these should both not be special-cased. The relevant code for feature collection is in src/librustc/middle/lib_features.rs
, so that's a good place to start looking.
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.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.