about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-08-10 10:02:03 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-08-10 10:02:03 -0700
commitdfb3713cdb7303a250d8b23792fe801319edf36c (patch)
treef54aeb9880393e6b93fd5d11eff1e5bbe9c86585
parenta3b84ad197fb209d903857df747af3ca0a1f2c25 (diff)
downloadrust-dfb3713cdb7303a250d8b23792fe801319edf36c.tar.gz
rust-dfb3713cdb7303a250d8b23792fe801319edf36c.zip
Update error message to clarify that it's not the enum itself that's non_exhaustive
-rw-r--r--compiler/rustc_typeck/src/check/cast.rs2
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/cast.rs b/compiler/rustc_typeck/src/check/cast.rs
index 88bce06297b..6c7b2a2889f 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 c5f0105296f..a61dcf8399f 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