Inconsistency in pattern matching over the never type !
as an associated trait type
#112997
Labels
!
as an associated trait type
#112997
I have found a weird inconsistency when
!
is behind a trait and wrapped as a constructor field:Note the errors in the comments. I hoped for the typechecker to notice that
Tagged
could not be a value ofTagInt<Erase>
, and thus not demand covering that case. On the other hand, when I follow the advice and consider it, the typechecker suddenly realizes this is dead code and suggests removing it. Regardless whetherTagged
should be covered or not , it feels incorrect that the typechecker contradicts itself.The
Tagged
case forTagInt<Erase>
is indeed unreachable, and the compiler manages to detect it. I would therefore expect the last match to be correct, and the previous one to be marked as it is. This bug breaks my way towards emulating GADTs in Rust's type system. At least I don't see any other hack for conditional constructors.Meta
rustc --version --verbose
:Build output
The text was updated successfully, but these errors were encountered: