Skip to content

[crater only] Syntactically reject equality predicates#153513

Draft
fmease wants to merge 1 commit intorust-lang:mainfrom
fmease:gate-eq-pred
Draft

[crater only] Syntactically reject equality predicates#153513
fmease wants to merge 1 commit intorust-lang:mainfrom
fmease:gate-eq-pred

Conversation

@fmease
Copy link
Member

@fmease fmease commented Mar 6, 2026

Equality predicates have been syntactically valid since PR #39158 / nightly-2017-02-02 / 1.16 (released 2017-03-16, 9 years ago), both forms that is: $ty = $ty and $ty == $ty. They're not registered as an unstable feature despite having a tracking issue (#20041). Naturally, they don't have a feature gate. Of course, we reject them post-expansion, so they are still semantically invalid.

Parser scaffolding for $ident = $ty was added in RUST-19391 (2014) which was then generalized to $ty = $ty in RUST-20002 (2014) and extended to additionally cover $ty == $ty in RUST-39158 (2017). As mentioned, the last PR also made them grammatical.

RUST-87471 (2021) attempted to start impl'ing typeck'ing but it was closed due to concerns: #87471 (comment) (already back in 2017 there were concerns: https://github.com/rust-lang/rust/pull/39158/changes#r97811244).

In 2022, T-lang discussed this feature during a meeting and raised concerns: #20041 (comment). However, they were inclined to accept a restricted form, namely T::AssocTy = $ty (T is a (self) ty param or a self ty alias) and <$ty as Trait>::AssocTy = $ty since that's trivial to support in HIR ty lowering (this is still accurate).


I'm very interested in making equality predicates syntactically invalid again for now (whether through a hard error or a pre-expansion feature gate error) (even if we end up permitting & impl'ing the proposed restricted forms, it's still valuable to gate this feature because we still need to decide between = and ==, we ought not have both). So let's crater this.

@fmease fmease added rla-silenced Silences rust-log-analyzer postings to the PR it's added on. C-crater Category: Issue / PR for tracking crater runs labels Mar 6, 2026
@rustbot rustbot added 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 Mar 6, 2026
@fmease
Copy link
Member Author

fmease commented Mar 6, 2026

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 6, 2026
[crater only] Syntactically reject equality predicates
@fmease fmease added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 6, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 6, 2026

☀️ Try build successful (CI)
Build commit: 3248bac (3248bace201b6227b0ff78eacc8b00d805551a86, parent: ff086354c9fc93e1da1d2f4d255456624fbcd099)

@fmease
Copy link
Member Author

fmease commented Mar 6, 2026

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-153513 created and queued.
🤖 Automatically detected try build 3248bac
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-crater Category: Issue / PR for tracking crater runs rla-silenced Silences rust-log-analyzer postings to the PR it's added on. S-waiting-on-crater Status: Waiting on a crater run to be completed. 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