]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir/src/transform/check_unsafety.rs
Auto merge of #85617 - hi-rustin:rustin-patch-fix, r=estebank
[rust.git] / compiler / rustc_mir / src / transform / check_unsafety.rs
index 9a4e51203d2b22f2fb11277f17657876bfd0d99e..103ddda1a1d262c45069da1fab78d78404a7776b 100644 (file)
@@ -221,7 +221,7 @@ fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location:
             }
 
             let base_ty = base.ty(self.body, self.tcx).ty;
-            if base_ty.ty_adt_def().map_or(false, |adt| adt.is_union()) {
+            if base_ty.is_union() {
                 // If we did not hit a `Deref` yet and the overall place use is an assignment, the
                 // rules are different.
                 let assign_to_field = !saw_deref