fix incorrect suggestions in private import diagnostic#156244
Merged
rust-bors[bot] merged 6 commits intorust-lang:mainfrom May 8, 2026
Merged
fix incorrect suggestions in private import diagnostic#156244rust-bors[bot] merged 6 commits intorust-lang:mainfrom
rust-bors[bot] merged 6 commits intorust-lang:mainfrom
Conversation
Collaborator
|
rustbot has assigned @jdonszelmann. Use Why was this reviewer chosen?The reviewer was selected based on:
|
mu001999
reviewed
May 7, 2026
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
I'll take a look later this day |
mu001999
reviewed
May 8, 2026
mu001999
reviewed
May 8, 2026
mu001999
reviewed
May 8, 2026
Co-Authored-By: mu001999 <mu001999@outlook.com>
This comment has been minimized.
This comment has been minimized.
el-ev
commented
May 8, 2026
mu001999
reviewed
May 8, 2026
Member
|
r? me |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
May 8, 2026
Rollup of 5 pull requests Successful merges: - #156141 (Resolve some cases of #132279 by using the right typing mode in the next solver) - #156244 (fix incorrect suggestions in private import diagnostic) - #156306 (Move tests consts) - #156333 (Avoid invalid spans in dotdotdot rest pattern suggestions) - #156337 (rustc-dev-guide subtree update)
rust-timer
added a commit
that referenced
this pull request
May 8, 2026
Rollup merge of #156244 - el-ev:issue156060, r=mu001999 fix incorrect suggestions in private import diagnostic Resolves #156060. 1. In nested imports like `use two::{One, ...}`, the diagnostic suggested replacing the `One` with a multi-segment path of a different module, producing invalid code like `use crate::two::{one::One, Two}`. Skip it when `single_nested == true`. 2. Stop unconditionally skipping the first segment of `import.module_path`, which can produce incorrect paths in edition 2018 and later. 3. Mark the suggestion as "directly" instead of "through the re-export" when the import's source is the definition itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View all comments
Resolves #156060.
use two::{One, ...}, the diagnostic suggested replacing theOnewith a multi-segment path of a different module, producing invalid code likeuse crate::two::{one::One, Two}. Skip it whensingle_nested == true.import.module_path, which can produce incorrect paths in edition 2018 and later.