Skip to content

Simplify parse_limited#155447

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
JonathanBrouwer:simplify-parse-limited
Apr 18, 2026
Merged

Simplify parse_limited#155447
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
JonathanBrouwer:simplify-parse-limited

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer commented Apr 17, 2026

View all comments

Removes unnecessary arguments from parse_limited and cleans up feature gating of on_unknown_attr

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 17, 2026
Comment thread compiler/rustc_attr_parsing/src/interface.rs Outdated
@JonathanBrouwer JonathanBrouwer changed the title Simplify parse_limited and cleanup more attribute parsing Simplify parse_limited Apr 17, 2026
@JonathanBrouwer JonathanBrouwer force-pushed the simplify-parse-limited branch from 25d63eb to 8bc2d3c Compare April 17, 2026 15:31
{
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
return;
}
Copy link
Copy Markdown
Contributor

@mejrs mejrs Apr 17, 2026

Choose a reason for hiding this comment

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

There are a couple of rustc_resolve types that have a pub on_unknown_attr: Option<OnUnknownData> field.

This change makes it so they can be Some even if the feature is not used. The reason you aren't noticing it is because of this check at the use site:

let (message, label, notes) = if self.tcx.features().diagnostic_on_unknown()
&& let Some(directive) = errors[0].1.on_unknown_attr.as_ref().map(|a| &a.directive)
{

I'm on the fence whether it's worth the effort to "fix" this. But I would like some comments here and there to document whatever we end up with.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've moved the feature gating to the initialization of on_unknown_attr, and added some comments

@JonathanBrouwer JonathanBrouwer force-pushed the simplify-parse-limited branch from 8bc2d3c to a5d0719 Compare April 18, 2026 09:18
@JonathanBrouwer JonathanBrouwer marked this pull request as ready for review April 18, 2026 09:29
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

Some changes occurred to diagnostic attributes.

cc @mejrs

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@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 Apr 18, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 72 candidates
  • Random selection from 17 candidates

@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

JonathanBrouwer commented Apr 18, 2026

r? @mejrs

@rustbot rustbot assigned mejrs and unassigned JohnTitor Apr 18, 2026
Copy link
Copy Markdown
Contributor

@mejrs mejrs 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 with either check inverted or unchanged perf run results

View changes since this review

Comment thread compiler/rustc_resolve/src/imports.rs
Comment thread compiler/rustc_resolve/src/imports.rs Outdated
@mejrs mejrs 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 Apr 18, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 18, 2026
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 18, 2026

☀️ Try build successful (CI)
Build commit: 3a904ef (3a904ef4079a69d50808d3bf162da01e6f6576e0, parent: 8da2d28cbd5a4e2b93e028e709afe09541671663)

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (3a904ef): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 493.313s -> 493.585s (0.06%)
Artifact size: 394.36 MiB -> 394.37 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@JonathanBrouwer JonathanBrouwer force-pushed the simplify-parse-limited branch from a5d0719 to e0d7848 Compare April 18, 2026 17:15
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

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
Contributor Author

@bors r=mejrs rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 18, 2026

📌 Commit e0d7848 has been approved by mejrs

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 18, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 18, 2026
…ited, r=mejrs

Simplify `parse_limited`

Removes unnecessary arguments from `parse_limited` and cleans up feature gating of `on_unknown_attr`
rust-bors bot pushed a commit that referenced this pull request Apr 18, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #150230 (spec next chunk for trustedlen)
 - #155284 (net::tcp/udp: fix docs about how set_nonblocking is implemented)
 - #146870 (fix: add aliasing rules for Box)
 - #154003 (Make std::fs::File Send on UEFI)
 - #155187 (std: fix HashMap RNG docs wording)
 - #155255 (Document why `layout.align() + layout.size()` doesn't overflow)
 - #155351 (Reorganize tests from `tests/ui/issues/`)
 - #155406 (std: Update dependency on `wasi` crate)
 - #155447 (Simplify `parse_limited`)
 - #155481 (Delete `SizeSkeleton::Generic`)
@rust-bors rust-bors bot merged commit c165777 into rust-lang:main Apr 18, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 18, 2026
rust-timer added a commit that referenced this pull request Apr 18, 2026
Rollup merge of #155447 - JonathanBrouwer:simplify-parse-limited, r=mejrs

Simplify `parse_limited`

Removes unnecessary arguments from `parse_limited` and cleans up feature gating of `on_unknown_attr`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

6 participants