Skip to content

Document tool attribute ambiguity error - #2397

Open
mejrs wants to merge 1 commit into
rust-lang:masterfrom
mejrs:tool_ambiguity
Open

mejrs wants to merge 1 commit into
rust-lang:masterfrom
mejrs:tool_ambiguity

Conversation

@mejrs

@mejrs mejrs commented Oct 27, 2026

Copy link
Copy Markdown
Member

This accompanies the changes in rust-lang/rust#162597

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Oct 27, 2026
Comment thread src/names/name-resolution.md Outdated
pub struct X;
```

Tool attributes exist in the [tool prelude], so items explicitly brought into scope as well as the [extern prelude] will shadow them. As these paths can only resolve to either an attribute macro, which is ambiguous, something that isn't valid in an attribute, or only partially resolve, shadowing a tool attribute in this way is also an error.

@DanielEScherzer DanielEScherzer Oct 27, 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.

Suggested change
Tool attributes exist in the [tool prelude], so items explicitly brought into scope as well as the [extern prelude] will shadow them. As these paths can only resolve to either an attribute macro, which is ambiguous, something that isn't valid in an attribute, or only partially resolve, shadowing a tool attribute in this way is also an error.
Tool attributes exist in the [tool prelude], so items explicitly brought into scope as well as items in the [extern prelude] will shadow them. As these paths can only resolve to either an attribute macro, which is ambiguous, something that isn't valid in an attribute, or only partially resolve, shadowing a tool attribute in this way is also an error.

the second sentence is also a bit hard to read - my understanding is that this is saying that the paths can only

  • resolve to an attribute macro (and resolving to that is ambiguous)
  • resolve to something that isn't valid in an attribute
  • partially resolve

but it took a few read throughs to figure that out

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.

Yeah, I'm not sure about the wording either, suggestions welcome.

Comment thread src/names/name-resolution.md Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants