diff --git a/compiler/rustc_typeck/src/check/cast.rs b/compiler/rustc_typeck/src/check/cast.rs index 88bce06297bdb..6c7b2a2889fa4 100644 --- a/compiler/rustc_typeck/src/check/cast.rs +++ b/compiler/rustc_typeck/src/check/cast.rs @@ -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(); } } diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr index c5f0105296fff..a61dcf8399f17 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr @@ -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