Skip to content

feat(lint): Add missing_no_std_attribute#16974

Open
bushrat011899 wants to merge 1 commit intorust-lang:masterfrom
bushrat011899:missing_no_std_attribute
Open

feat(lint): Add missing_no_std_attribute#16974
bushrat011899 wants to merge 1 commit intorust-lang:masterfrom
bushrat011899:missing_no_std_attribute

Conversation

@bushrat011899
Copy link
Copy Markdown

@bushrat011899 bushrat011899 commented May 8, 2026

Objective

Details

This lint checks if a crate does not contain the #![no_std] attribute (either bare or through cfg_attr) and suggests adding both it and extern crate std;.

+ #![no_std]
+ extern crate std;

This suggestion is inserted at the ModSpans::inject_use_span point.

Notes

  • No AI tooling of any kind was used during the creation of this PR.
  • This suggestion can fail if the crate currently relies on items through and exclusive to the std::prelude. I have marked it as Applicability::MaybeIncorrect to reflect this.

changelog: [missing_no_std_attribute]: add new lint for lack of #![no_std] attribute

@rustbot rustbot added needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 8, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 8, 2026

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@bushrat011899 bushrat011899 force-pushed the missing_no_std_attribute branch from 1a3eda3 to 61ef36d Compare May 8, 2026 03:05
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Lintcheck changes for 61ef36d

Lint Added Removed Changed
clippy::missing_no_std_attribute 142 0 0

This comment will be updated if you push new changes

@bushrat011899
Copy link
Copy Markdown
Author

@rustbot author

Looks like the cfg_attr check didn't work as I expected. Will fix that up...

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 8, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 8, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants