Skip to content

Configuration stripping should happen before checking feature gates #24434

Closed
@fhahn

Description

@fhahn

At the moment, feature_gate::check_crate_macros is executed before strip_unconfigured_items which leads things like #![cfg_attr(stage0, feature(custom_attribute))] in https://github.com/rust-lang/rust/blob/master/src/libcore/lib.rs#L50 beeing ignored (#![feature(custom_attribute)] is again defined in the same file).

The following test illustrates the problem

// compile-flags:--cfg set1
//
#![cfg_attr(set1, feature(custom_attribute))]

#![foobar]
fn main() {}

It fails with The attributefoobaris currently unknown to the the compiler and may have meaning added to it in the future, because of the problem mentioned above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions