Add Ty::is_union
predicate and use it
This commit is contained in:
parent
012c323467
commit
c898681a86
10 changed files with 31 additions and 55 deletions
|
@ -753,12 +753,8 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
|||
| ProjectionElem::Field(..)
|
||||
| ProjectionElem::Index(_) => {
|
||||
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
|
||||
match base_ty.ty_adt_def() {
|
||||
Some(def) if def.is_union() => {
|
||||
self.check_op(ops::UnionAccess);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
if base_ty.is_union() {
|
||||
self.check_op(ops::UnionAccess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue