Skip to content

Syntactically reject leading parenthesized precise capturing lists in bare trait object types ((use<…>)+) - #162652

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
fmease:reject-bare-obj-paren-use
Oct 9, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
fmease:reject-bare-obj-paren-use

Conversation

@fmease

@fmease fmease commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #162269. Addresses fmease/rasur#7 (item 6).

(No LLM was or will be used by me during the entire creation process of this PR)

@fmease fmease added I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination labels Sep 11, 2026
@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 Sep 11, 2026
@rustbot

rustbot commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

r? @adwinwhite

rustbot has assigned @adwinwhite.
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, parser
  • compiler, parser expanded to 76 candidates
  • Random selection from 21 candidates

@fmease

fmease commented Sep 11, 2026 •

Copy link
Copy Markdown
Member Author

This is so niche that it does not need a crater run IMO and it might not even require an FCP.

@fmease fmease changed the title Syntactically reject parenthesized precise capturing lists in bare trait object types ((use<…>)+) Syntactically reject leading parenthesized precise capturing lists in bare trait object types ((use<…>)+) Sep 11, 2026
@fmease
fmease force-pushed the reject-bare-obj-paren-use branch from 1c3974f to b41ef23 Compare September 11, 2026 16:25
@fmease

fmease commented Sep 11, 2026 •

Copy link
Copy Markdown
Member Author

Context for T-lang:

We generally only support parenthesizing trait bounds, not however any other kind of bound (namely, outlives-bounds and use-bounds) and as it stands there would be no use in generalizing this part of the grammar. So we allow bounds like (Trait), (for<'a> path::to::Trait<'a>) and (Fn() -> i32) but we don't allow ('a) or (use<N>)...

...Well, when precise capturing lists were introduced & stabilized, something was overlooked: While we correctly reject bare trait object types1 like Trait + (use<T>) (where the use-bound doesn't come first) before this PR we would incorrectly syntactically accept bare trait object types like (use<T>) + Trait or (use<>)+ (where the use-bounds come first).

Note that all of this only concerns the grammar of Rust as use-bounds are semantically invalid in trait object types anyway. This is just part of my ongoing efforts to deep clean Rust's grammar + rustc's parser.

Arguably this is super niche and thus I actually think that merging this w/o a T-lang FCP would be fine but I wanted to at least inform you of this.

The Reference doesn't need updating as it already conforms to what I expect & propose here. See also TraitObjectType, Bound etc.

Footnotes

  1. Which are syntactically legal in all editions by the way; they're merely semantically illegal in Rust >=2021. ↩

@fmease
fmease force-pushed the reject-bare-obj-paren-use branch from b41ef23 to fc6fa6d Compare September 11, 2026 16:51
@fmease fmease added waived-reference-pr This language change does not need a Reference PR. S-waiting-on-t-lang Status: Awaiting decision from T-lang labels Sep 11, 2026
@traviscross traviscross added P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang T-lang Relevant to the language team labels Sep 16, 2026
@tmandry

tmandry commented Sep 16, 2026

Copy link
Copy Markdown
Member

@rfcbot fcp merge lang

@rust-rfcbot

rust-rfcbot commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

@tmandry has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Sep 16, 2026
@traviscross

Copy link
Copy Markdown
Contributor

Thanks @fmease.

@rfcbot reviewed

@nikomatsakis

This comment was marked as outdated.

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Sep 23, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@nikomatsakis

Copy link
Copy Markdown
Contributor

@rfcbot reviewed

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination labels Sep 23, 2026

@adwinwhite adwinwhite 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 Oct 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fc6fa6d has been approved by adwinwhite

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 Oct 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to rust-lang#162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #163634 (move overflow lint computation into decorator)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to #162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
@rust-bors

rust-bors Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Testing commit fc6fa6d with merge 5458ca3...

Workflow: https://github.com/rust-lang/rust/actions/runs/37902581796

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to rust-lang#162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors yield
Yielding to enclosing rollup

@rust-bors

rust-bors Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #164024.

rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to rust-lang#162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to rust-lang#162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163972 (const-eval: ICE when we hit a non-const fn)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to rust-lang#162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163950 (don't treat inherited opaques as defining)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #161998 ( Support type-relative assoc item paths in generic param defaults & const param types)
 - #162106 (Helpful suggestions for incorrect address-of mutability (2))
 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163938 (-Zassumptions-on-binders: rewrite alias outlives constraints more goodly)
 - #163939 (Better debug impls for some assumptions on binders types)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #164042 (Allow testing cg-gcc on any target)
 - #162443 (Do not retain `Normalization` goal errors in nested goals for `BestObligationVisitor:: non_trivial_candidates `)
 - #162908 (Fix - const parameters rejected when identical)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163950 (don't treat inherited opaques as defining)
 - #163972 (const-eval: ICE when we hit a non-const fn)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164008 (properly ignore the current goal's usages)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
@rust-bors
rust-bors Bot merged commit 79c674c into rust-lang:main Oct 9, 2026
13 of 14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 9, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
Rollup merge of #162652 - fmease:reject-bare-obj-paren-use, r=adwinwhite

Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`)

Follow-up to #162269. Addresses fmease/rasur#7 (item 6).

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
@fmease
fmease deleted the reject-bare-obj-paren-use branch October 10, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. 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. T-lang Relevant to the language team to-announce Announce this issue on triage meeting waived-reference-pr This language change does not need a Reference PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants