Skip to content

apply -Zcrate-attr attributes before the crate attributes - #165482

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Albab-Hasan:crate-attr-tests
Nov 7, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Albab-Hasan:crate-attr-tests

Conversation

@Albab-Hasan

@Albab-Hasan Albab-Hasan commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

part of #138287. -Zcrate-attr attributes were appended after the source crate attrs so -Zcrate-attr=deny(unused) overrode a source #![warn(unused)]. rfc 3791 says they apply first. this inserts them at the front in command line order and adds two ordering tests. the edition and position tests landed separately in #165429 so i dropped mine.

r? oli-obk

@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 Nov 5, 2026
@Albab-Hasan

Albab-Hasan commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

i know about #165429 adding edition and file/line/column tests in the same directory (the pr didnt exist when i started working on mine). once it lands ill drop my edition and file-line-column tests and rebase so this only has the ordering tests and the fix

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@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 Nov 6, 2026
@rustbot

rustbot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

rfc 3791 says crate attributes from the command line apply before the attributes in the crate root. ordering-cli checks that several -Zcrate-attr flags apply in command line order. ordering-source records the current behaviour where the command line deny overrides the source warn, which is the wrong way round.
cmdline attributes were pushed after the attributes parsed from source, so a -Zcrate-attr lint level overrode the same lint set in the crate root. rfc 3791 says they apply before the source attributes. they are now inserted at the front of the crate attributes in command line order.
@rustbot

rustbot commented Nov 7, 2026

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.

@Albab-Hasan

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot 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 Nov 7, 2026
@Albab-Hasan
Albab-Hasan requested a review from oli-obk November 7, 2026 06:17

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 851c9e0 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 7, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 7, 2026
…i-obk

apply `-Zcrate-attr` attributes before the crate attributes

part of rust-lang#138287. `-Zcrate-attr` attributes were appended after the source crate attrs so `-Zcrate-attr=deny(unused)` overrode a source `#![warn(unused)]`. rfc 3791 says they apply first. this inserts them at the front in command line order and adds two ordering tests. the edition and position tests landed separately in rust-lang#165429 so i dropped mine.

r? oli-obk
rust-bors Bot pushed a commit that referenced this pull request Nov 7, 2026
Rollup of 5 pull requests

Successful merges:

 - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes)
 - #147696 (Implement `bit` and `set_bit` for integral types.)
 - #163202 (nuttx: use updated pollfd definition)
 - #163571 ([rustdoc] Render `Deref` methods on aliased items)
 - #165482 (apply `-Zcrate-attr` attributes before the crate attributes)
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 7, 2026
…i-obk

apply `-Zcrate-attr` attributes before the crate attributes

part of rust-lang#138287. `-Zcrate-attr` attributes were appended after the source crate attrs so `-Zcrate-attr=deny(unused)` overrode a source `#![warn(unused)]`. rfc 3791 says they apply first. this inserts them at the front in command line order and adds two ordering tests. the edition and position tests landed separately in rust-lang#165429 so i dropped mine.

r? oli-obk
rust-bors Bot pushed a commit that referenced this pull request Nov 7, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes)
 - #165469 (Make notable trait `i` badges `<span>` instead of `<a>`)
 - #165576 (compiletest: Reject whitespace between `//` & `@` and reject leading revision conditions like (e.g., `//[rev]@ dir`))
 - #147696 (Implement `bit` and `set_bit` for integral types.)
 - #163202 (nuttx: use updated pollfd definition)
 - #165482 (apply `-Zcrate-attr` attributes before the crate attributes)
 - #165517 (Migrate basic block ctors to require Terminator where possible)
 - #165552 (use lang item instead of name when assembling builtin `Clone::clone` instances)
rust-bors Bot pushed a commit that referenced this pull request Nov 7, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes)
 - #165469 (Make notable trait `i` badges `<span>` instead of `<a>`)
 - #165576 (compiletest: Reject whitespace between `//` & `@` and reject leading revision conditions like (e.g., `//[rev]@ dir`))
 - #147696 (Implement `bit` and `set_bit` for integral types.)
 - #163202 (nuttx: use updated pollfd definition)
 - #165482 (apply `-Zcrate-attr` attributes before the crate attributes)
 - #165517 (Migrate basic block ctors to require Terminator where possible)
 - #165552 (use lang item instead of name when assembling builtin `Clone::clone` instances)
@rust-bors
rust-bors Bot merged commit e971d78 into rust-lang:main Nov 7, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 7, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 7, 2026
Rollup merge of #165482 - Albab-Hasan:crate-attr-tests, r=oli-obk

apply `-Zcrate-attr` attributes before the crate attributes

part of #138287. `-Zcrate-attr` attributes were appended after the source crate attrs so `-Zcrate-attr=deny(unused)` overrode a source `#![warn(unused)]`. rfc 3791 says they apply first. this inserts them at the front in command line order and adds two ordering tests. the edition and position tests landed separately in #165429 so i dropped mine.

r? oli-obk
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.

3 participants