Skip to content

collect doc alias as tips during resolution #127721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Jul 14, 2024

Close #124273

Collect the symbol in the doc alias attributes and provide a tip when a match is found.

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 Jul 14, 2024
@petrochenkov petrochenkov self-assigned this Jul 14, 2024
@petrochenkov
Copy link
Contributor

In general I'd prefer to maybe not do this at all for the local crate.
It will simplify things and avoid doing work on a good path.
The crate authors are the same people who write the doc alias attributes, so these hints are unlikely to be useful for them.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 2024
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jul 16, 2024

I'd prefer to maybe not do this at all for the local crate.

Agree and accept this suggestion.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 16, 2024
@petrochenkov petrochenkov removed their assignment Jul 16, 2024
@bors

This comment was marked as resolved.

@lolbinarycat lolbinarycat added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2024
@lolbinarycat
Copy link
Contributor

@bvanjoi triage here, any interest in rebasing this?

@alex-semenyuk
Copy link
Member

@bvanjoi
Form wg-triage. Could you please rebase that it will be ready for review?

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Oct 11, 2024

Rebased. @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 11, 2024
@bors

This comment was marked as resolved.

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Oct 13, 2024

Update: Fixes the incorrect submodule...

@bors

This comment was marked as resolved.

@wesleywiser
Copy link
Member

Hi @estebank could you take a look at this when you get a chance? Thanks 🙂

@jieyouxu
Copy link
Member

jieyouxu commented May 8, 2025

Maybe r? @petrochenkov (or reroll)?

@rustbot rustbot assigned petrochenkov and unassigned estebank May 8, 2025
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 9, 2025
@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label May 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 12, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@bvanjoi
Copy link
Contributor Author

bvanjoi commented May 13, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 13, 2025
let mod_seg = path[path.len() - 2];
if let Some(seg_id) = mod_seg.id
&& let Some(res) = self.r.partial_res_map.get(&seg_id)
&& let hir::def::Res::Def(hir::def::DefKind::Mod, module) = res.base_res()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
&& let hir::def::Res::Def(hir::def::DefKind::Mod, module) = res.base_res()
&& let Res::Def(DefKind::Mod, module) = res.expect_full_res()

}
}
} else {
let mod_seg = path[path.len() - 2];
Copy link
Contributor

@petrochenkov petrochenkov May 13, 2025

Choose a reason for hiding this comment

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

The unresolved segment is not necessarily last, index of the unresolved segment can be obtained using partial_res.unresolved_segments() in smart_resolve_path_fragment (or it's 0 if there is no partial resolution).

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Support rustc_confusables on items other than methods
9 participants