panic when trying to destructure union as enum
This commit is contained in:
parent
df3e003378
commit
b86ed4a425
1 changed files with 2 additions and 2 deletions
|
@ -201,14 +201,14 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
||||||
AscribeUserType { .. } |
|
AscribeUserType { .. } |
|
||||||
// creating a union literal
|
// creating a union literal
|
||||||
Constant { .. } => {},
|
Constant { .. } => {},
|
||||||
Variant { .. } | Leaf { .. } | Or { .. } => {
|
Leaf { .. } | Or { .. } => {
|
||||||
// pattern matching with a union and not doing something like v = Union { bar: 5 }
|
// pattern matching with a union and not doing something like v = Union { bar: 5 }
|
||||||
self.in_union_destructure = true;
|
self.in_union_destructure = true;
|
||||||
visit::walk_pat(self, pat);
|
visit::walk_pat(self, pat);
|
||||||
self.in_union_destructure = false;
|
self.in_union_destructure = false;
|
||||||
return; // don't walk pattern
|
return; // don't walk pattern
|
||||||
}
|
}
|
||||||
Deref { .. } | Range { .. } | Slice { .. } | Array { .. } =>
|
Variant { .. } | Deref { .. } | Range { .. } | Slice { .. } | Array { .. } =>
|
||||||
unreachable!("impossible union destructuring type"),
|
unreachable!("impossible union destructuring type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue