Skip to content

Use core::str in invalid_from_utf8 lint message for no_std crates - #166285

Open
bardiharborow wants to merge 1 commit into
rust-lang:mainfrom
bardiharborow:invalid-from-utf8-no-std
Open

bardiharborow wants to merge 1 commit into
rust-lang:mainfrom
bardiharborow:invalid-from-utf8-no-std

Conversation

@bardiharborow

@bardiharborow bardiharborow commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

The lint message hardcoded std::str::from_utf8, which is misleading in no_std crates where only core::str is available.

This PR uses std_or_core to pick the right crate path.

@rustbot label +A-lints +A-diagnostics +T-compiler +D-papercut

The lint message hardcoded `std::str::from_utf8`, which is misleading in
`no_std` crates where only `core::str` is available.

This commit uses `std_or_core` to pick the right crate path.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-papercut Diagnostics: An error or lint that needs small tweaks. labels Nov 21, 2026
@bardiharborow
bardiharborow marked this pull request as ready for review November 21, 2026 04:56
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 21, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 21, 2026
@rustbot

rustbot commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

r? @fee1-dead

rustbot has assigned @fee1-dead.
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: compiler
  • compiler expanded to 79 candidates
  • Random selection from 21 candidates

@fee1-dead

Copy link
Copy Markdown
Member

Perhaps I don't understand the motivation very well, but: why do we have to print the full path? Why not just use the method name itself?

@fee1-dead fee1-dead added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2026

This branch has not been deployed

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

Labels

A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-papercut Diagnostics: An error or lint that needs small tweaks. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler 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