Skip to content

unsafe keyword docs: bring back unsafe_op_in_unsafe_fn lint discussion#152613

Open
RalfJung wants to merge 2 commits intorust-lang:mainfrom
RalfJung:unsafe-keyword-docs
Open

unsafe keyword docs: bring back unsafe_op_in_unsafe_fn lint discussion#152613
RalfJung wants to merge 2 commits intorust-lang:mainfrom
RalfJung:unsafe-keyword-docs

Conversation

@RalfJung
Copy link
Copy Markdown
Member

@RalfJung RalfJung commented Feb 14, 2026

@traviscross in #141471 you asked me to also update the text to account for the edition change. Apparently I did that by entirely removing this part of the discussion (except for a dangling forward reference, a "see below"). Given that old editions still exist and given that unsafe_op_in_unsafe_fn is just a lint so the old behavior also still exists on new editions, I am no longer sure that was a good idea, so this brings back the old text with some editing to explain the current situation.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 14, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 14, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet

@traviscross
Copy link
Copy Markdown
Contributor

Will remind myself of the earlier discussion and have a look.

@RalfJung
Copy link
Copy Markdown
Member Author

RalfJung commented Apr 6, 2026

@traviscross friendly ping :)
(or should I go ask another reviewer?)

Comment on lines +2050 to +2052
/// Historically, these two are not mutually exclusive, as can be seen in `unsafe fn`: the body of
/// an `unsafe fn` is, on old editions, treated like an unsafe block. The `unsafe_op_in_unsafe_fn`
/// lint can be enabled to change that (and that lint is enabled by default since edition 2024).
Copy link
Copy Markdown
Contributor

@traviscross traviscross Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

While better, this is still leading with the old-edition behavior (e.g., "can be enabled...") and burying the current-edition behavior in a parenthetical.

I'll leave this tab open and think about concrete wording that might be better. The second part of this diff, below, is better about this -- that wording is stronger. Maybe that could be copied up here, or this part shortened again.

(Also, see the double space between "two" and "are".)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is leading with "unsafe has two uses" in the old unchanged text above, which is the new behavior. Only then do we get to the historic part where we mention the old behavior.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a reword, maybe that works better?

@traviscross
Copy link
Copy Markdown
Contributor

Thanks for the ping.

@RalfJung RalfJung force-pushed the unsafe-keyword-docs branch from fed1c33 to 40b2d7a Compare April 8, 2026 20:46
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung RalfJung force-pushed the unsafe-keyword-docs branch from 40b2d7a to f3ed56d Compare April 8, 2026 20:51
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants