Skip to content

Fix invalid type suggestion for item nested in function#154540

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
chenyukang:yukang-fix-146786-unusable-path-suggestion
Mar 30, 2026
Merged

Fix invalid type suggestion for item nested in function#154540
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
chenyukang:yukang-fix-146786-unusable-path-suggestion

Conversation

@chenyukang
Copy link
Copy Markdown
Member

@chenyukang chenyukang commented Mar 29, 2026

Fixes #146786

I also tried to add the omit_parent logic in pretty formatter here:
https://github.com/chenyukang/rust/blob/69b6d26d05006dca7556abc555fb0e029ecf1f4e/compiler/rustc_middle/src/ty/print/pretty.rs#L2240-L2295
so that we don't need to add should_omit_parent_def_path and reset_path.

but seems there will be duplicate print code with default_print_def_path.

maybe r? @estebank

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 29, 2026
@chenyukang chenyukang changed the title fix invalid type suggestion for item nested in function Fix invalid type suggestion for item nested in function Mar 29, 2026
@estebank
Copy link
Copy Markdown
Contributor

I'm pretty sure there are many other suggestions where we should be using this macro. We should figure out a way of automating it for the Diag API (maybe a lint?) and we should modify the structured suggestion machinery to always use this.

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 29, 2026

📌 Commit 69b6d26 has been approved by estebank

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 Mar 29, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 29, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #154074 (don't drop arguments' temporaries in `dbg!`)
 - #154328 (rustdoc: add missing {os,target,target_env} values for cfg pretty printer)
 - #154540 (Fix invalid type suggestion for item nested in function)
 - #154549 (Add regression test for recursive lazy type alias normalization ICE)
 - #153373 (Fix LegacyKeyValueFormat report from docker build: powerpc)
 - #154322 (feat: reimplement `hash_map!` macro)
 - #154416 (Add `IoSplit` diagnostic item for `std::io::Split`)
 - #154486 (std_detect on AArch64 Darwin: Detect FEAT_SVE_B16B16)
 - #154508 (Fix ambiguous parsing in bootstrap.py)
 - #154518 (Panic in Hermit clock_gettime)
 - #154530 (update zulip link in `std` documentation)
@rust-bors rust-bors bot merged commit 883eda3 into rust-lang:main Mar 30, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 30, 2026
rust-timer added a commit that referenced this pull request Mar 30, 2026
Rollup merge of #154540 - chenyukang:yukang-fix-146786-unusable-path-suggestion, r=estebank

Fix invalid type suggestion for item nested in function

Fixes #146786

I also tried to add the `omit_parent` logic in pretty formatter here:
https://github.com/chenyukang/rust/blob/69b6d26d05006dca7556abc555fb0e029ecf1f4e/compiler/rustc_middle/src/ty/print/pretty.rs#L2240-L2295
so that we don't need to add `should_omit_parent_def_path` and `reset_path`.

but seems there will be duplicate print code with `default_print_def_path`.

maybe r? @estebank
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 30, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154074 (don't drop arguments' temporaries in `dbg!`)
 - rust-lang/rust#154328 (rustdoc: add missing {os,target,target_env} values for cfg pretty printer)
 - rust-lang/rust#154540 (Fix invalid type suggestion for item nested in function)
 - rust-lang/rust#154549 (Add regression test for recursive lazy type alias normalization ICE)
 - rust-lang/rust#153373 (Fix LegacyKeyValueFormat report from docker build: powerpc)
 - rust-lang/rust#154322 (feat: reimplement `hash_map!` macro)
 - rust-lang/rust#154416 (Add `IoSplit` diagnostic item for `std::io::Split`)
 - rust-lang/rust#154486 (std_detect on AArch64 Darwin: Detect FEAT_SVE_B16B16)
 - rust-lang/rust#154508 (Fix ambiguous parsing in bootstrap.py)
 - rust-lang/rust#154518 (Panic in Hermit clock_gettime)
 - rust-lang/rust#154530 (update zulip link in `std` documentation)
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.

Unusable path suggestion for item nested in function

3 participants