Recursive RPIT causes E0792 (an error about TAIT): "this generic parameter must be used with a generic type parameter" #139350
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
I tried this code:
I expect the code to compile (although maybe the function might be impossible to call). Instead, on the latest nightly rust (
1.88.0-nightly (2025-04-02 d5b4c2e4f19b6d703737)
), I got this error:Version it worked on
The code compiles fine on rust 1.72.0 on godbolt.
Version with regression
The code gives the above error on rust 1.73.0 on godbolt.
Additional context
I was playing around trying to break rust, and I ran into this.
Removing the
: T
type annotation causes the code to compile fine.The E0792 error emitted by the compiler is an error about TAIT, which is weird, given that the code uses RPIT, not TAIT.
Another variant of the code is:
This variant gives:
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged +A-impl-trait
The text was updated successfully, but these errors were encountered: