Skip to content

Commit dfb3713

Browse files
committed
Update error message to clarify that it's not the enum itself that's non_exhaustive
1 parent a3b84ad commit dfb3713

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_typeck/src/check/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
601601
self.cast_ty,
602602
fcx,
603603
)
604-
.note("cannot cast a non-exhaustive enum defined in another crate")
604+
.note("cannot cast an enum with a non-exhaustive variant when it's defined in another crate")
605605
.emit();
606606
}
607607
}

src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0606]: casting `FieldLessWithNonExhaustiveVariant` as `u8` is invalid
44
LL | let d = e as u8;
55
| ^^^^^^^
66
|
7-
= note: cannot cast a non-exhaustive enum defined in another crate
7+
= note: cannot cast an enum with a non-exhaustive variant when it's defined in another crate
88

99
error: aborting due to previous error
1010

0 commit comments

Comments
 (0)