Skip to content

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Oct 15, 2025

These doc comments start out very clear by saying the caller "must" or "has to" ensure something, but the end with some form of "otherwise undefined behavior may result" which sounds like it is implementation-defined and seems to conflict with the way the paragraph starts. Consistent phrasing makes it clearer that when the safety precondition is violated, UB is encountered.

Some of the phrasing here is a bit awkward to me, I don't think we usually say "the behavior is undefined" @RalfJung right? But in either case I'm trying to be surgical in my edit here.

r? Amanieu

@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 Oct 15, 2025
@Amanieu
Copy link
Member

Amanieu commented Oct 15, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 15, 2025

📌 Commit 72396d9 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2025
bors added a commit that referenced this pull request Oct 15, 2025
Rollup of 7 pull requests

Successful merges:

 - #146841 (Stabilise `rotate_left` and `rotate_right` in `[_]` as `const fn` items.)
 - #146949 (Add vsx register support for ppc inline asm, and implement preserves_flag option)
 - #147539 (resolve: Use primitives for conditional mutability more consistently)
 - #147685 (remove span calls from deprecated attribute checking)
 - #147699 (Clairify docs for `AttributeKind::DocComment`)
 - #147706 (Add myself to review rotation)
 - #147711 (Clarify that UB will occur, not can/may in GlobalAlloc docs)

r? `@ghost`
`@rustbot` modify labels: rollup
@RalfJung
Copy link
Member

We do have quite a few hits for "behavior is undefined" so seems fine to me.

@bors bors merged commit ed6077a into rust-lang:master Oct 15, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Oct 15, 2025
Rollup merge of #147711 - saethlin:GlobalAlloc-safety, r=Amanieu

Clarify that UB will occur, not can/may in GlobalAlloc docs

These doc comments start out very clear by saying the caller "must" or "has to" ensure something, but the end with some form of "otherwise undefined behavior may result" which sounds like it is implementation-defined and seems to conflict with the way the paragraph starts. Consistent phrasing makes it clearer that when the safety precondition is violated, UB is encountered.

Some of the phrasing here is a bit awkward to me, I don't think we usually say "the behavior is undefined" `@RalfJung` right? But in either case I'm trying to be surgical in my edit here.

r? Amanieu
@rustbot rustbot added this to the 1.92.0 milestone Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants