Skip to content

expand: Feature gate out-of-line modules in proc macro input#66078

Merged
bors merged 1 commit intorust-lang:masterfrom
petrochenkov:gateout
Nov 4, 2019
Merged

expand: Feature gate out-of-line modules in proc macro input#66078
bors merged 1 commit intorust-lang:masterfrom
petrochenkov:gateout

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

Extracted from #64273.

We are currently gating attributes applied directly to mod items because there are unresolved questions about out-of-line modules and their behavior is very likely to change.

However, you can sneak an out-of-line module into an attribute macro input using modules nested into other items like

#[my_attr]
fn m() {
    #[path = "zzz.rs"]
    mod n; // what tokens does the `my_attr` macro see?
}

This PR prevents that and emits a feature gate error for this case as well.

r? @Centril
It would be great to land this before beta.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2019
Copy link
Copy Markdown
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

r=me p=2 with comment addressed or not if short on time.

Comment thread src/test/ui/proc-macro/attributes-on-modules-fail.rs Outdated
@petrochenkov
Copy link
Copy Markdown
Contributor Author

@bors r=Centril p=2

@bors
Copy link
Copy Markdown
Collaborator

bors commented Nov 4, 2019

📌 Commit e7cedc9 has been approved by Centril

@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 Nov 4, 2019
@bors
Copy link
Copy Markdown
Collaborator

bors commented Nov 4, 2019

⌛ Testing commit e7cedc9 with merge 2477e24...

bors added a commit that referenced this pull request Nov 4, 2019
expand: Feature gate out-of-line modules in proc macro input

Extracted from #64273.

We are currently gating attributes applied directly to `mod` items because there are unresolved questions about out-of-line modules and their behavior is very likely to change.

However, you can sneak an out-of-line module into an attribute macro input using modules nested into other items like
```rust
#[my_attr]
fn m() {
    #[path = "zzz.rs"]
    mod n; // what tokens does the `my_attr` macro see?
}
```
This PR prevents that and emits a feature gate error for this case as well.

r? @Centril
It would be great to land this before beta.
@bors
Copy link
Copy Markdown
Collaborator

bors commented Nov 4, 2019

☀️ Test successful - checks-azure
Approved by: Centril
Pushing 2477e24 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 4, 2019
@bors bors merged commit e7cedc9 into rust-lang:master Nov 4, 2019
@petrochenkov petrochenkov deleted the gateout branch February 22, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants