Update error message to clarify that it's not the enum itself that's non_exhaustive

This commit is contained in:
Scott McMurray 2022-08-10 10:02:03 -07:00
parent a3b84ad197
commit dfb3713cdb
2 changed files with 2 additions and 2 deletions

View file

@ -601,7 +601,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
self.cast_ty,
fcx,
)
.note("cannot cast a non-exhaustive enum defined in another crate")
.note("cannot cast an enum with a non-exhaustive variant when it's defined in another crate")
.emit();
}
}

View file

@ -4,7 +4,7 @@ error[E0606]: casting `FieldLessWithNonExhaustiveVariant` as `u8` is invalid
LL | let d = e as u8;
| ^^^^^^^
|
= note: cannot cast a non-exhaustive enum defined in another crate
= note: cannot cast an enum with a non-exhaustive variant when it's defined in another crate
error: aborting due to previous error