Skip to content

Add target checking to #[register_tool] - #157377

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
JonathanBrouwer:target-register-tool
Jun 4, 2026
Merged

Add target checking to #[register_tool]#157377
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
JonathanBrouwer:target-register-tool

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbotrustbot 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. labels Jun 3, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@mejrsmejrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I understand crate level attributes, actually 🤔

View changes since this review

Comment on lines +107 to 110
#[register_tool(xyz)]
//~^ WARN crate-level attribute should be an inner attribute
unreachable!();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this be an error? I notice crate level attrs are basically allowed anywhere, I'd like that not to be the case with a new crate level attribute if I can help it.

@rust-bors

This comment has been minimized.

@JonathanBrouwer

Copy link
Copy Markdown
MemberAuthor

The reason that this is a warning is because it historically was. When we initially wrote the attribute parsers the first goal was preserving behavior.

I think it makes sense to change this tho, and I think the time has come that for all unstable attributes we should change this. I'll open a PR tomorrow

@mejrsmejrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-borsBot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📋 This PR cannot be approved because it has merge conflicts. Please resolve the conflicts and try again.

@mejrsmejrs 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 4, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JonathanBrouwer

Copy link
Copy Markdown
MemberAuthor

@bors r=mejrs

@rust-bors

rust-borsBot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 957e505 has been approved by mejrs

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Jun 4, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 4, 2026
…uwer
Rollup of 4 pull requests
Successful merges:
- #157297 (Add more tests for the `optimize` attribute)
- #157377 (Add target checking to `#[register_tool]`)
- #157138 (Add doc comment to `Vec::clone`)
- #157400 (Add regression test for late-bound type param in nested `impl Trait`)
@rust-bors
rust-borsBot merged commit 96fc9b8 into rust-lang:mainJun 4, 2026
12 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jun 4, 2026
rust-timer added a commit that referenced this pull request Jun 4, 2026
Rollup merge of #157377 - JonathanBrouwer:target-register-tool, r=mejrs
Add target checking to `#[register_tool]`
r? @mejrs
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 5, 2026
…=mejrs
Make distinction between crate-level attributes that are warned vs errored
r? @mejrs
This is a follow-up to rust-lang#157377 (comment)
This PR makes all unstable crate-level attributes error on incorrect targets.
To make the diff more helpful, I'd recommend reviewing the two commits separately.
* The first commit introduces the infra & makes all crate-level attributes a warning, the commit should have no effect
* The second commit undoes some changes from the first commit, to make all unstable crate-level attributes error
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 5, 2026
…=mejrs
Make distinction between crate-level attributes that are warned vs errored
r? @mejrs
This is a follow-up to rust-lang#157377 (comment)
This PR makes all unstable crate-level attributes error on incorrect targets.
To make the diff more helpful, I'd recommend reviewing the two commits separately.
* The first commit introduces the infra & makes all crate-level attributes a warning, the commit should have no effect
* The second commit undoes some changes from the first commit, to make all unstable crate-level attributes error
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 5, 2026
…=mejrs
Make distinction between crate-level attributes that are warned vs errored
r? @mejrs
This is a follow-up to rust-lang#157377 (comment)
This PR makes all unstable crate-level attributes error on incorrect targets.
To make the diff more helpful, I'd recommend reviewing the two commits separately.
* The first commit introduces the infra & makes all crate-level attributes a warning, the commit should have no effect
* The second commit undoes some changes from the first commit, to make all unstable crate-level attributes error
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 5, 2026
…=mejrs
Make distinction between crate-level attributes that are warned vs errored
r? @mejrs
This is a follow-up to rust-lang#157377 (comment)
This PR makes all unstable crate-level attributes error on incorrect targets.
To make the diff more helpful, I'd recommend reviewing the two commits separately.
* The first commit introduces the infra & makes all crate-level attributes a warning, the commit should have no effect
* The second commit undoes some changes from the first commit, to make all unstable crate-level attributes error
rust-timer added a commit that referenced this pull request Jun 5, 2026
Rollup merge of #157443 - JonathanBrouwer:crate-level-err, r=mejrs
Make distinction between crate-level attributes that are warned vs errored
r? @mejrs
This is a follow-up to #157377 (comment)
This PR makes all unstable crate-level attributes error on incorrect targets.
To make the diff more helpful, I'd recommend reviewing the two commits separately.
* The first commit introduces the infra & makes all crate-level attributes a warning, the commit should have no effect
* The second commit undoes some changes from the first commit, to make all unstable crate-level attributes error
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

3 participants

@JonathanBrouwer@rustbot@mejrs