Skip to content

Don't report missing safety doc for #[target_feature(enable)] attributed functions#17051

Open
DJMcNab wants to merge 3 commits into
rust-lang:masterfrom
DJMcNab:target-feature-unsafety
Open

Don't report missing safety doc for #[target_feature(enable)] attributed functions#17051
DJMcNab wants to merge 3 commits into
rust-lang:masterfrom
DJMcNab:target-feature-unsafety

Conversation

@DJMcNab
Copy link
Copy Markdown
Contributor

@DJMcNab DJMcNab commented May 22, 2026

changelog: missing_safety_doc: No longer applies for #[target_feature(enable)] attributes functions.

As of Rust 1.86, these functions are safe to call in a context with the specified target features already enabled. I asked Ralf at RustWeek, who thought that these functions probably shouldn't require a safety comment. However, Clippy currently requires this with missing_safety_doc. This PR removes the warning in that case.


I also wrote a version which is MSRV aware version, which handled the MSRV change. This is the first commit of this branch. I don't think this is the correct implementation, but I have it for discussion. For this, the changelog would be:

missing_safety_doc: No longer applies for #[target_feature(enable)] attributes functions if your MSRV has target features 1.1.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 22, 2026

Some changes occurred in clippy_lints/src/doc

cc @notriddle

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 22, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 22, 2026

r? @llogiq

rustbot has assigned @llogiq.
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, llogiq, samueltardieu

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants