[crater only] Syntactically reject equality predicates#153513
Draft
fmease wants to merge 1 commit intorust-lang:mainfrom
Draft
[crater only] Syntactically reject equality predicates#153513fmease wants to merge 1 commit intorust-lang:mainfrom
fmease wants to merge 1 commit intorust-lang:mainfrom
Conversation
Member
Author
|
@bors try |
This comment has been minimized.
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
Contributor
Member
Author
|
@craterbot check |
Collaborator
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 = $tyand$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 = $tywas added in RUST-19391 (2014) which was then generalized to$ty = $tyin RUST-20002 (2014) and extended to additionally cover$ty == $tyin 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(Tis a (self) ty param or a self ty alias) and<$ty as Trait>::AssocTy = $tysince 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.