Unused generic parameter E0392 not emitted in recursive type that is behind Cell #92561
Labels
A-variance
Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
When you have an unused lifetime (or type) parameter, it is a hard error. If you "use" that parameter by having a recursive type,
rustc
still notices that it's unused and gives the error. But if that recursion goes throughCell
(also works withRefCell
), the error is not emitted and the program works fine.Maybe this should be a diagnostics issue, but I put this under bug since it causes programs to compile that shouldn't under the normal rules.
I tried this code:
playground
I expected to see this happen:
E0392, because the lifetime is actually not used
Instead, this happened:
No error, and the program compiled
Meta
This happens on the latest
nightly-2022-01-04
on the playgroundThe text was updated successfully, but these errors were encountered: