Skip to content

Make String::from_utf8_unchecked const - #698

Merged
sgued merged 1 commit into
rust-embedded:mainfrom
sundew-sensing:const-from-utf8-unchecked
Nov 7, 2026
Merged

sgued merged 1 commit into
rust-embedded:mainfrom
sundew-sensing:const-from-utf8-unchecked

Conversation

@surgura

@surgura surgura commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

#527 made String::from_utf8_unchecked const. #504 then had to drop const, because the body started calling the non-const cast_len_type. #552 removed that call again, but const was never restored. As a result, no release has it const, even though the v0.9.0 changelog lists it.

Related: #515.

I plan to do more const work, but I thought I'd start with the low-hanging fruit.

AI disclosure
I used Claude (Opus 5.5 extra-high) to

  • figure out that I need this const in my own codebase,
  • dig through the issues and PRs to figure out why this was not const,
  • create the small patch,
  • assist in learning that the patch makes sense,
  • and draft the above message.

I manually verified and adjusted of course :)

rust-embedded#527 made it const, but the generic length type from rust-embedded#504 rewrote the
function and dropped `const` before any release included it.

Refs rust-embedded#515.
@sgued

sgued commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

LGTM

@sgued
sgued added this pull request to the merge queue Nov 7, 2026
Merged via the queue into rust-embedded:main with commit 0511a45 Nov 7, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants