Skip to content

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

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

Closed
estebank opened this issue Dec 28, 2024 · 0 comments
Closed

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

estebank opened this issue Dec 28, 2024 · 0 comments
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. L-unused_attributes Lint: unused_attributes requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

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.

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. L-unused_attributes Lint: unused_attributes requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 28, 2024
@compiler-errors compiler-errors changed the title #![feautre(..)] outside of crate root only warns and should be lowder #![feature(..)] outside of crate root only warns and should be louder Dec 28, 2024
@chenyukang chenyukang self-assigned this Jan 17, 2025
@fmease fmease closed this as completed Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. L-unused_attributes Lint: unused_attributes requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants