diff options
| author | Smitty <me@smitop.com> | 2021-07-09 15:22:12 -0400 |
|---|---|---|
| committer | Smitty <me@smitop.com> | 2021-07-09 15:22:12 -0400 |
| commit | b86ed4a425b3fa830fa031ed7fe7187728403440 (patch) | |
| tree | af5a194051195cff5e06de7f1f6cef68fc7759de | |
| parent | df3e003378b8b896a9e4eecbd944c83d38d831f4 (diff) | |
| download | rust-b86ed4a425b3fa830fa031ed7fe7187728403440.tar.gz rust-b86ed4a425b3fa830fa031ed7fe7187728403440.zip | |
panic when trying to destructure union as enum
| -rw-r--r-- | compiler/rustc_mir_build/src/check_unsafety.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 0aec6318295..c3af98fae9d 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -201,14 +201,14 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { AscribeUserType { .. } | // creating a union literal Constant { .. } => {}, - Variant { .. } | Leaf { .. } | Or { .. } => { + Leaf { .. } | Or { .. } => { // pattern matching with a union and not doing something like v = Union { bar: 5 } self.in_union_destructure = true; visit::walk_pat(self, pat); self.in_union_destructure = false; return; // don't walk pattern } - Deref { .. } | Range { .. } | Slice { .. } | Array { .. } => + Variant { .. } | Deref { .. } | Range { .. } | Slice { .. } | Array { .. } => unreachable!("impossible union destructuring type"), } } |
