Skip to content

Add a rule for attribute macro outline modules - #2310

Merged
traviscross merged 1 commit into
rust-lang:masterfrom
ehuss:attr-macro-mod
Jul 28, 2026
Merged

Add a rule for attribute macro outline modules#2310
traviscross merged 1 commit into
rust-lang:masterfrom
ehuss:attr-macro-mod

Conversation

@ehuss

@ehuss ehuss commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

rust-lang/rust#157857 stabilized the ability to use #[my macro] mod foo;. The reference never specified that this was not allowed, so it doesn't absolutely need to be changed for this. However, since this was something that the lang team considered deeply enough on its own, it seems worthy to be explicit about this behavior.

This is an alternative to #2284. Since we already have a rule that specifies where the attributes are allowed, this follows more closely to that to specify the behavior when applied to one of these module items.

rust-lang/rust#157857 stabilized the ability to
use `#[my macro] mod foo;`. The reference never specified that this was
not allowed, so it doesn't absolutely need to be changed for this.
However, since this was something that the lang team considered deeply
enough on its own, it seems worthy to be explicit about this behavior.
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jul 9, 2026
@traviscross

Copy link
Copy Markdown
Contributor

Makes sense to me. Thanks @ehuss.

@traviscross
traviscross added this pull request to the merge queue Jul 28, 2026
Merged via the queue into rust-lang:master with commit bec6b5e Jul 28, 2026
6 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jul 28, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 11, 2026
Update books

## rust-lang/reference

9 commits in afdc77bab886d4455c11247cdd32391bfab636ae..82da570bafd9efed421bdbae0f8603ede8dd308b
2026-08-08 22:04:17 UTC to 2026-07-28 18:20:15 UTC

- add c-variadic function definitions (rust-lang/reference#2177)
- Update `no_mangle` to use the attribute template (rust-lang/reference#1904)
- enums with fields: clarify that repr(C, int) is quite different from repr(int) (rust-lang/reference#2227)
- aliasing rules also apply inside private fields (rust-lang/reference#2304)
- attributes: do not explain syntax in rules (rust-lang/reference#2306)
- Document prohibition on inner attribute macros (rust-lang/reference#2311)
- Use authentication for linkcheck (rust-lang/reference#2319)
- Stabilize passing 128-bit integers via vector registers with `asm!` on x86 (rust-lang/reference#2313)
- Add a rule for attribute macro outline modules (rust-lang/reference#2310)
@rustbot rustbot added this to the 1.99.0 milestone Aug 11, 2026
rust-timer added a commit to rust-lang/rust that referenced this pull request Aug 11, 2026
Rollup merge of #160866 - rustbot:docs-update, r=traviscross

Update books

## rust-lang/reference

9 commits in afdc77bab886d4455c11247cdd32391bfab636ae..82da570bafd9efed421bdbae0f8603ede8dd308b
2026-08-08 22:04:17 UTC to 2026-07-28 18:20:15 UTC

- add c-variadic function definitions (rust-lang/reference#2177)
- Update `no_mangle` to use the attribute template (rust-lang/reference#1904)
- enums with fields: clarify that repr(C, int) is quite different from repr(int) (rust-lang/reference#2227)
- aliasing rules also apply inside private fields (rust-lang/reference#2304)
- attributes: do not explain syntax in rules (rust-lang/reference#2306)
- Document prohibition on inner attribute macros (rust-lang/reference#2311)
- Use authentication for linkcheck (rust-lang/reference#2319)
- Stabilize passing 128-bit integers via vector registers with `asm!` on x86 (rust-lang/reference#2313)
- Add a rule for attribute macro outline modules (rust-lang/reference#2310)
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