Rollup merge of #85934 - tmiasko:is-union, r=jackh726

Add `Ty::is_union` predicate
This commit is contained in:
Yuki Okushi
2021-06-03 14:35:41 +09:00
committed by GitHub
10 changed files with 32 additions and 59 deletions

View File

@@ -752,12 +752,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);
}
}
}