Skip to content

fix: resolve path on all namespace on resolve_path - #22743

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
dfireBird:fix-nameref-classify
Jul 27, 2026
Merged

fix: resolve path on all namespace on resolve_path#22743
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
dfireBird:fix-nameref-classify

Conversation

@dfireBird

@dfireBird dfireBird commented Jul 9, 2026

Copy link
Copy Markdown
Member

Thanks @ChayimFriedman2 for the initial work.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 9, 2026
@rustbot

This comment has been minimized.

@dfireBird dfireBird changed the title fix: resolve paht on all namespace on resolve_path fix: resolve path on all namespace on resolve_path Jul 9, 2026
@dfireBird
dfireBird force-pushed the fix-nameref-classify branch from 9faf499 to ad1c7c1 Compare July 9, 2026 13:18
@rustbot

This comment has been minimized.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

I don't think "half work" is a descriptive commit name 😅 Feel free to squash.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Also for Clippy you need to rebase on master.

@dfireBird

Copy link
Copy Markdown
Member Author

I don't think "half work" is a descriptive commit name 😅 Feel free to squash.

I just pushed didn't think much with that 😅

Also for Clippy you need to rebase on master.

I rebased a bit early lol.

@dfireBird
dfireBird force-pushed the fix-nameref-classify branch from ad1c7c1 to 816b5e8 Compare July 10, 2026 15:55
@rustbot

This comment has been minimized.

@dfireBird
dfireBird force-pushed the fix-nameref-classify branch from 816b5e8 to f441e34 Compare July 10, 2026 15:57
@rustbot

This comment has been minimized.

@dfireBird
dfireBird force-pushed the fix-nameref-classify branch from f441e34 to ed59858 Compare July 20, 2026 10:20
@rustbot

This comment has been minimized.

Comment thread crates/hir/src/source_analyzer.rs Outdated
let mut types_is_visible = false;
let mut values_is_visible = false;
let mut macros_is_visible = false;
let mut types = types().or_else(items).map(|(res, vis)| {

@ChayimFriedman2 ChayimFriedman2 Jul 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I wrote this, but this can be inspect().

View changes since the review

Comment thread crates/hir/src/source_analyzer.rs Outdated
.unwrap_or_else(|| PathResolutionPerNs::new(types(), None, None))
if !resolve_per_ns {
if prefer_value_ns {
if let Some((res, vis)) = values()

@ChayimFriedman2 ChayimFriedman2 Jul 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means we can resolve twice when !resolve_per_ns. So I think we should hoist the declaration of types, values and macros, and X_is_visible, and set them initially to None as <Option<Option<_>>> and None as Option<bool>. Then if !resolve_per_ns, return with them if they resolve to something visible, or otherwise set the corresponding namespace to Some(resolution) and X_is_visible to Some(is_visible). Then after the if, we do:

let types = types.unwrap_or_else(|| ...);
...
let types_is_visible = types_is_visible.unwrap_or_else(|| types.inspect(...));
...

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did something in this lines. I think it can now resolve at most once but correct me if I'm wrong.

@dfireBird
dfireBird force-pushed the fix-nameref-classify branch from ed59858 to 4bc9b21 Compare July 27, 2026 05:54
@rustbot

rustbot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ChayimFriedman2 ChayimFriedman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Jul 27, 2026
Merged via the queue into rust-lang:master with commit a7d2343 Jul 27, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants