Skip to content

Fix invalid type suggestion for item nested in function#154540

Open
chenyukang wants to merge 1 commit intorust-lang:mainfrom
chenyukang:yukang-fix-146786-unusable-path-suggestion
Open

Fix invalid type suggestion for item nested in function#154540
chenyukang wants to merge 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
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 29, 2026
…ble-path-suggestion, r=estebank

Fix invalid type suggestion for item nested in function

Fixes rust-lang#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
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