Skip to content

Don't suggest std:: rustfix paths in #![no_std] crates - #163096

Merged
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
lapla-cogito:std_or_core
Sep 24, 2026
Merged

rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
lapla-cogito:std_or_core

Conversation

@lapla-cogito

Copy link
Copy Markdown
Contributor

Several lints emit rustfix suggestions with hard-coded std::... paths. In #![no_std] crates those paths do not exist of course, so cargo fix can leave the crate unable to compile.

This is best reviewed per commit.

@rustbot

rustbot commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
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 77 candidates
  • Random selection from 18 candidates

Comment thread compiler/rustc_lint/src/utils.rs Outdated
}

/// Crate to use for rustfix / diagnostic paths that exist in both `std` and `core`. Returns `None` for `#![no_core]`.
pub(crate) fn std_or_core(cx: &LateContext<'_>) -> Option<&'static str> {

@lapla-cogito lapla-cogito Sep 21, 2026 •

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.

Note that Clippy has a function that does the same thing. Once this PR is merged (and after a sync occurs), I think I’ll prepare a patch to make Clippy use the std_or_core from rustc instead.

https://github.com/rust-lang/rust-clippy/blob/df7957bde892aebe3d74c9e97f3b9f7d4a38f0f7/clippy_utils/src/lib.rs#L2054

View changes since the review

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 21, 2026
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2026
Comment thread compiler/rustc_lint/src/transmute.rs Outdated
@rustbot rustbot 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 Sep 23, 2026
@rustbot

rustbot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@lapla-cogito

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 23, 2026
Comment thread compiler/rustc_lint/src/types.rs Outdated
@oli-obk

oli-obk commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2b022a3 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 23, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 23, 2026
Don't suggest `std::` rustfix paths in `#![no_std]` crates

Several lints emit rustfix suggestions with hard-coded `std::...` paths. In `#![no_std]` crates those paths do not exist of course, so `cargo fix` can leave the crate unable to compile.

This is best reviewed per commit.
rust-bors Bot pushed a commit that referenced this pull request Sep 24, 2026
Rollup of 8 pull requests

Successful merges:

 - #162976 (fix quadratic naming of duplicate sidebar links)
 - #163222 (Enable EII tests for cg_gcc)
 - #162942 (Remove `StashKey::AssociatedTypeSuggestion`)
 - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates)
 - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable)
 - #163185 (properly decrement available_depth on cycles and provisional cache hits)
 - #163214 (revert r14 register names for arm)
 - #163226 (miri subtree update)
rust-bors Bot pushed a commit that referenced this pull request Sep 24, 2026
Rollup of 8 pull requests

Successful merges:

 - #162976 (fix quadratic naming of duplicate sidebar links)
 - #163222 (Enable EII tests for cg_gcc)
 - #162942 (Remove `StashKey::AssociatedTypeSuggestion`)
 - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates)
 - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable)
 - #163185 (properly decrement available_depth on cycles and provisional cache hits)
 - #163214 (revert r14 register names for arm)
 - #163226 (miri subtree update)
rust-bors Bot pushed a commit that referenced this pull request Sep 24, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #162976 (fix quadratic naming of duplicate sidebar links)
 - #161275 (Refactor `core::cmp::{smallest, largest}` & add `mir-opt` test)
 - #163143 (cg_llvm: Use fewer FFI calls to check the target CPU's features)
 - #163188 (Adjust for Arm64EC name mangling when checking for exported symbols)
 - #163211 (`rustc_builtin_macros` cleanup, part 6)
 - #161386 (Don't merge distinct impl candidates)
 - #162942 (Remove `StashKey::AssociatedTypeSuggestion`)
 - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates)
 - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable)
 - #163185 (properly decrement available_depth on cycles and provisional cache hits)
 - #163214 (revert r14 register names for arm)
 - #163226 (miri subtree update)
 - #163228 (Add regression test for trait predicate with escaping bounds)
 - #163234 (`rustc_dump_symbol_name`: add demangling information as a note instead)
@rust-bors
rust-bors Bot merged commit 8915d07 into rust-lang:main Sep 24, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 24, 2026
Rollup merge of #163096 - lapla-cogito:std_or_core, r=oli-obk

Don't suggest `std::` rustfix paths in `#![no_std]` crates

Several lints emit rustfix suggestions with hard-coded `std::...` paths. In `#![no_std]` crates those paths do not exist of course, so `cargo fix` can leave the crate unable to compile.

This is best reviewed per commit.
@lapla-cogito
lapla-cogito deleted the std_or_core branch September 24, 2026 14:19
pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Sep 25, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#162976 (fix quadratic naming of duplicate sidebar links)
 - rust-lang/rust#161275 (Refactor `core::cmp::{smallest, largest}` & add `mir-opt` test)
 - rust-lang/rust#163143 (cg_llvm: Use fewer FFI calls to check the target CPU's features)
 - rust-lang/rust#163188 (Adjust for Arm64EC name mangling when checking for exported symbols)
 - rust-lang/rust#163211 (`rustc_builtin_macros` cleanup, part 6)
 - rust-lang/rust#161386 (Don't merge distinct impl candidates)
 - rust-lang/rust#162942 (Remove `StashKey::AssociatedTypeSuggestion`)
 - rust-lang/rust#163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates)
 - rust-lang/rust#163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable)
 - rust-lang/rust#163185 (properly decrement available_depth on cycles and provisional cache hits)
 - rust-lang/rust#163214 (revert r14 register names for arm)
 - rust-lang/rust#163226 (miri subtree update)
 - rust-lang/rust#163228 (Add regression test for trait predicate with escaping bounds)
 - rust-lang/rust#163234 (`rustc_dump_symbol_name`: add demangling information as a note instead)
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-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.

4 participants