Skip to content

Add safety comments in alloc::Wtf8 - #161292

Open
yilin0518 wants to merge 1 commit into
rust-lang:mainfrom
yilin0518:fix_alloc_wtf8
Open

Add safety comments in alloc::Wtf8#161292
yilin0518 wants to merge 1 commit into
rust-lang:mainfrom
yilin0518:fix_alloc_wtf8

Conversation

@yilin0518

@yilin0518 yilin0518 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This PR follow up #160824 and add some safety section for unsafe APIs. This PR focus on Wtf8 in alloc and fix every Untriged mentioned in #160824.

Before this PR, #161271 had add some safety sections for Wtf8 in core.

I'm looking forward to your review and give me any feedback to improve this PR.

@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 Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
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: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e, tgross35

@yilin0518 yilin0518 changed the title Add safety comments in alloc/Wtf8 Add safety comments in alloc::Wtf8 Aug 18, 2026
Comment thread library/alloc/src/wtf8/mod.rs Outdated
/// marked unsafe.
/// # Safety
///
/// `value` must contain well-formed WTF-8.

@clarfonthey clarfonthey Aug 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably make sure that there's some linkable documentation for this. Obviously only available in private docs, but still useful.

(Nonblocking, just mentioning.)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can provide a link like following:

/// `value` must contain [well-formed WTF-8](https://wtf-8.codeberg.page/#well-formed).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can provide a link like following:

/// `value` must contain [well-formed WTF-8](https://wtf-8.codeberg.page/#well-formed).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can provide a link like following:

/// `value` must contain [well-formed WTF-8](https://wtf-8.codeberg.page/#well-formed).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have provide the linkable documentation, hoping that it is useful.

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.

3 participants