Skip to content

resolve: Tweak private_macro_use lint to be compatible with upcoming macro prelude changes #141934

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

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Jun 2, 2025

Unblocks #139493.
Zulip thread requesting help - #t-compiler/help > Help requested for effects of #139493.

This PR by itself shouldn't cause any observable changes, its only observable effect is that the prelude changes from #139493 will no longer cause regressions in tests like tests/ui/imports/issue-119369.rs or tests/ui/extern/issue-80074.rs.

This is achieved by moving the "is this thing in stdlib prelude" check from an early point (fn process_macro_use_imports) to a later point (fn record_use_inner), at which the stdlib prelude is already populated and can be inspected.
(The is_builtin_macro check is subsumed by the stdlib prelude check, all built-in macros go through the stdlib prelude anyway.)

@rustbot
Copy link
Collaborator

rustbot commented Jun 2, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jun 2, 2025
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Is there some way we can test this behavior? Also for posterity could you explain why this blocks that PR you linked in the description?

@rustbot rustbot 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 Jun 3, 2025
@petrochenkov
Copy link
Contributor Author

@compiler-errors I've updated the PR description.

@petrochenkov petrochenkov 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 Jun 3, 2025
@compiler-errors
Copy link
Member

Thanks.

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 11, 2025

📌 Commit 6a5bad3 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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 Jun 11, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
…r-errors

resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes

Unblocks rust-lang#139493.
Zulip thread requesting help - [#t-compiler/help > Help requested for effects of rust-lang#139493](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Help.20requested.20for.20effects.20of.20.23139493/with/514653911).

This PR by itself shouldn't cause any observable changes, its only observable effect is that the prelude changes from rust-lang#139493 will no longer cause regressions in tests like `tests/ui/imports/issue-119369.rs` or `tests/ui/extern/issue-80074.rs`.

This is achieved by moving the "is this thing in stdlib prelude" check from an early point (`fn process_macro_use_imports`) to a later point (`fn record_use_inner`), at which the stdlib prelude is already populated and can be inspected.
(The `is_builtin_macro` check is subsumed by the stdlib prelude check, all built-in macros go through the stdlib prelude anyway.)
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
…r-errors

resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes

Unblocks rust-lang#139493.
Zulip thread requesting help - [#t-compiler/help > Help requested for effects of rust-lang#139493](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Help.20requested.20for.20effects.20of.20.23139493/with/514653911).

This PR by itself shouldn't cause any observable changes, its only observable effect is that the prelude changes from rust-lang#139493 will no longer cause regressions in tests like `tests/ui/imports/issue-119369.rs` or `tests/ui/extern/issue-80074.rs`.

This is achieved by moving the "is this thing in stdlib prelude" check from an early point (`fn process_macro_use_imports`) to a later point (`fn record_use_inner`), at which the stdlib prelude is already populated and can be inspected.
(The `is_builtin_macro` check is subsumed by the stdlib prelude check, all built-in macros go through the stdlib prelude anyway.)
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.

4 participants