Skip to content

Port #[macro_export] to the new attribute parsing infrastructure #143857

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

Periodic1911
Copy link
Contributor

Ports macro_export to the new attribute parsing infrastructure for #131229 (comment)

r? @oli-obk

cc @JonathanBrouwer @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jul 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 12, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

Some changes occurred in compiler/rustc_attr_data_structures

cc @jdonszelmann

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

@@ -26,12 +22,15 @@ macro_rules! d {
}

#[macro_export()]
//~^ ERROR malformed `macro_export` attribute input
Copy link
Contributor Author

@Periodic1911 Periodic1911 Jul 12, 2025

Choose a reason for hiding this comment

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

This is a breaking change! Malformed macro_export attributes have had a lint since 2023 (deny(invalid_macro_export_arguments)). This PR makes this an error.
Furthermore, #[macro_export()] has been accepted since 2023, and this PR makes that an error too.

As discussed in #142838 (comment), we can make breaking changes as long as we do a crater run. So this PR needs a crater run.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jul 13, 2025

☔ The latest upstream changes (presumably #140717) made this pull request unmergeable. Please resolve the merge conflicts.

@jdonszelmann
Copy link
Contributor

@Periodic1911 if you rebase I'll run a crater

@jdonszelmann jdonszelmann added T-lang Relevant to the language team I-lang-nominated Nominated for discussion during a lang team meeting. labels Jul 13, 2025
@jdonszelmann
Copy link
Contributor

@rust-lang/lang this makes a long-standing warning an error with a crater run. Just wanted to notify you

@traviscross traviscross added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jul 13, 2025
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Jul 13, 2025
@jdonszelmann
Copy link
Contributor

@bors try

bors added a commit that referenced this pull request Jul 13, 2025
Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for #131229 (comment)

r? `@oli-obk`

cc `@JonathanBrouwer` `@jdonszelmann`
@bors
Copy link
Collaborator

bors commented Jul 13, 2025

⌛ Trying commit ac1f122 with merge 723ab94...

@bors
Copy link
Collaborator

bors commented Jul 13, 2025

☀️ Try build successful - checks-actions
Build commit: 723ab94 (723ab942d877517caf445dafde0416803ef56501)

@jdonszelmann
Copy link
Contributor

@craterbot check

@rust-log-analyzer

This comment has been minimized.

@Periodic1911
Copy link
Contributor Author

@bors r=@jdonszelmann

@bors
Copy link
Collaborator

bors commented Aug 1, 2025

📌 Commit 90fad60 has been approved by jdonszelmann

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 1, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 3, 2025
…zelmann

Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for rust-lang#131229 (comment)

r? `@oli-obk`

cc `@JonathanBrouwer` `@jdonszelmann`
bors added a commit that referenced this pull request Aug 3, 2025
Rollup of 14 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition)
 - #144070 (Implement `hash_map` macro )
 - #144322 (Add lint against dangling pointers from local variables)
 - #144443 (Make target pointer width in target json an integer)
 - #144667 (`AlignmentEnum` should just be `repr(usize)` now)
 - #144779 (Implement debugging output of the bootstrap Step graph into a DOT file)
 - #144790 (Multiple bounds checking elision failures)
 - #144794 (Port `#[coroutine]` to the new attribute system)
 - #144808 (`Interner` arg to `EarlyBinder` does not affect auto traits)
 - #144816 (Update E0562 to account for the new impl trait positions)
 - #144822 (Return a struct with named fields from `hash_owner_nodes`)
 - #144824 (Updated test links in compiler)
 - #144829 (Use full flag name in strip command for Darwin)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 3, 2025
…zelmann

Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for rust-lang#131229 (comment)

r? ``@oli-obk``

cc ``@JonathanBrouwer`` ``@jdonszelmann``
bors added a commit that referenced this pull request Aug 3, 2025
Rollup of 13 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition)
 - #144070 (Implement `hash_map` macro )
 - #144322 (Add lint against dangling pointers from local variables)
 - #144443 (Make target pointer width in target json an integer)
 - #144667 (`AlignmentEnum` should just be `repr(usize)` now)
 - #144790 (Multiple bounds checking elision failures)
 - #144794 (Port `#[coroutine]` to the new attribute system)
 - #144808 (`Interner` arg to `EarlyBinder` does not affect auto traits)
 - #144816 (Update E0562 to account for the new impl trait positions)
 - #144822 (Return a struct with named fields from `hash_owner_nodes`)
 - #144824 (Updated test links in compiler)
 - #144829 (Use full flag name in strip command for Darwin)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 3, 2025
…zelmann

Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for rust-lang#131229 (comment)

r? ```@oli-obk```

cc ```@JonathanBrouwer``` ```@jdonszelmann```
bors added a commit that referenced this pull request Aug 3, 2025
Rollup of 13 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #144070 (Implement `hash_map` macro )
 - #144322 (Add lint against dangling pointers from local variables)
 - #144667 (`AlignmentEnum` should just be `repr(usize)` now)
 - #144678 (Make no_mangle on foreign items explicit instead of implicit)
 - #144790 (Multiple bounds checking elision failures)
 - #144794 (Port `#[coroutine]` to the new attribute system)
 - #144805 (compiletest: Preliminary cleanup of `ProcRes` printing/unwinding)
 - #144808 (`Interner` arg to `EarlyBinder` does not affect auto traits)
 - #144816 (Update E0562 to account for the new impl trait positions)
 - #144822 (Return a struct with named fields from `hash_owner_nodes`)
 - #144824 (Updated test links in compiler)
 - #144829 (Use full flag name in strip command for Darwin)

r? `@ghost`
`@rustbot` modify labels: rollup
@@ -360,6 +360,9 @@ pub enum AttributeKind {
/// Represents `#[macro_escape]`.
MacroEscape(Span),

/// Represents [`#[macro_export}`](https://doc.rust-lang.org/reference/macros-by-example.html#r-macro.decl.scope.path).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Typo here; } should be ].

Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 3, 2025
…zelmann

Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for rust-lang#131229 (comment)

r? `@oli-obk`

cc `@JonathanBrouwer` `@jdonszelmann`
bors added a commit that referenced this pull request Aug 3, 2025
Rollup of 13 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #144070 (Implement `hash_map` macro )
 - #144322 (Add lint against dangling pointers from local variables)
 - #144667 (`AlignmentEnum` should just be `repr(usize)` now)
 - #144706 (Do not give function allocations alignment in consteval and Miri.)
 - #144790 (Multiple bounds checking elision failures)
 - #144794 (Port `#[coroutine]` to the new attribute system)
 - #144805 (compiletest: Preliminary cleanup of `ProcRes` printing/unwinding)
 - #144808 (`Interner` arg to `EarlyBinder` does not affect auto traits)
 - #144816 (Update E0562 to account for the new impl trait positions)
 - #144822 (Return a struct with named fields from `hash_owner_nodes`)
 - #144824 (Updated test links in compiler)
 - #144829 (Use full flag name in strip command for Darwin)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Aug 4, 2025

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout macro-export (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self macro-export --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging tests/ui/attributes/malformed-attrs.stderr
CONFLICT (content): Merge conflict in tests/ui/attributes/malformed-attrs.stderr
Auto-merging tests/ui/attributes/malformed-attrs.rs
Auto-merging compiler/rustc_passes/src/check_attr.rs
Auto-merging compiler/rustc_lint_defs/src/builtin.rs
Auto-merging compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Auto-merging compiler/rustc_hir/src/attrs/data_structures.rs
Auto-merging compiler/rustc_attr_parsing/src/context.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 4, 2025
@jdonszelmann
Copy link
Contributor

@Periodic1911 feel free to r=me again whenever, after rebase

@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label Aug 4, 2025
@Periodic1911
Copy link
Contributor Author

@bors r=@jdonszelmann

@bors
Copy link
Collaborator

bors commented Aug 4, 2025

📌 Commit 23e6be2 has been approved by jdonszelmann

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-json Area: Rustdoc JSON backend disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-lang Relevant to the language team T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.