Skip to content

#![feature(..)] outside of crate root only warns and should be louder #134856

Closed as duplicate of#49975
@estebank

Description

@estebank

When a feature attribute is declared anywhere but the crate root, we currently emit an unused attribute warning:

fn main() {
    #![feature(default_field_values)]
    let () = 1;
}

This has caused issues in the past with people not realizing that the attribute wasn't set in the right place. It should probably be its own error/deny-by-default lint, specifically for feature.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.L-unused_attributesLint: unused_attributesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions