fix(lint): std_instead_of_core false positives for core::io/MSRV#16964
fix(lint): std_instead_of_core false positives for core::io/MSRV#16964bushrat011899 wants to merge 1 commit intorust-lang:masterfrom
std_instead_of_core false positives for core::io/MSRV#16964Conversation
|
r? @Jarcho rustbot has assigned @Jarcho. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Lintcheck changes for bc66086
This comment will be updated if you push new changes |
This comment has been minimized.
This comment has been minimized.
|
Reminder, once the PR becomes ready for a review, use |
751c8ff to
bc2d729
Compare
This comment has been minimized.
This comment has been minimized.
87538e5 to
2ae396b
Compare
|
It was a little more involved than I anticipated, but I believe I have resolved the false positive I was intending to, and also solved a couple of additional multi-import ones. I've added additional test cases for the lint which should catch any regressions. This also solved some MSRV issues too. For example, Because I was struggling to understand how the lint worked initially, I've refactored it probably more than it strictly had to be. However I believe it is now easier to understand (at least to my new-to-clippy eyes), with additional comments and internal documentation. @rustbot ready |
std_instead_of_core false positive for core::iostd_instead_of_core false positives for core::io/MSRV
2ae396b to
bc66086
Compare
Objective
std_instead_of_core#13158.std_instead_of_core#13158Solution
Previously the lint had an exception for all instances of a stable item in an unstable module, primarily to allow certain intrinsics such as
copyto be accessible. Instead, I check for the presence ofrustc_allowed_through_unstable_modulesto handle those exceptions, and allow theis_stablecheck 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 #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
std_instead_of_corefalse positive forcore::iorust#156164Please 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.