Skip to content

fix(clippy): std_instead_of_core false positive for core::io#156164

Closed
bushrat011899 wants to merge 1 commit into
rust-lang:mainfrom
bushrat011899:fix_std_instead_of_core_for_core_io
Closed

fix(clippy): std_instead_of_core false positive for core::io#156164
bushrat011899 wants to merge 1 commit into
rust-lang:mainfrom
bushrat011899:fix_std_instead_of_core_for_core_io

Conversation

@bushrat011899

@bushrat011899 bushrat011899 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Objective

Solution

Previously the lint had an exception for all instances of a stable item in an unstable module, primarily to allow certain intrinsics such as copy to be accessible. Instead, I check for the presence of rustc_allowed_through_unstable_modules to handle those exceptions, and allow the is_stable check within the lint to early out as soon as any part of its path is unstable.


Notes

  • No AI tooling of any kind was used during the creation of this PR.

@rustbot

rustbot commented May 5, 2026

Copy link
Copy Markdown
Collaborator

The Clippy subtree was changed

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels May 5, 2026
@rustbot

rustbot commented May 5, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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:

  • Fallback group: @Mark-Simulacrum, @jieyouxu
  • @Mark-Simulacrum, @jieyouxu expanded to Mark-Simulacrum, jieyouxu

@samueltardieu

Copy link
Copy Markdown
Member

Could you please submit this Clippy-only PR to https://github.com/rust-lang/rust-clippy instead?

@bushrat011899

Copy link
Copy Markdown
Contributor Author

Can do! Apologies for the mixup.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 5, 2026
pull Bot pushed a commit to asukaminato0721/rust-clippy that referenced this pull request Jun 16, 2026
…t-lang#16964)

# Objective

- Fix false positive identified by @rktaxe in [this
comment](rust-lang#13158 (comment))
on rust-lang#13158.
- Fix rust-lang#13158

## Solution

Previously the lint had an exception for all instances of a stable item
in an unstable module, primarily to allow certain intrinsics such as
`copy` to be accessible. Instead, I check for the presence of
`rustc_allowed_through_unstable_modules` to handle those exceptions, and
allow the `is_stable` check within the lint to early out as soon as any
part of its path is unstable.

I believe this was the last piece required to resolve
rust-lang#13158, and have added tests for all examples
listed in the issue. If there are other examples of this lint failing,
I'd greatly appreciate seeing them!

---

## Notes

- No AI tooling of any kind was used during the creation of this PR.
- Originally opened (in error) as rust-lang/rust#156164

---

*Please write a short comment explaining your change (or "none" for
internal only changes)*

changelog: fix certain false positives for [`std_instead_of_core`] for
stable items in an unstable module (e.g., `core::io::ErrorKind`), and
other MSRV-unaware issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants