@@ -114,7 +114,7 @@ use rustc_middle::mir::{
114114 traversal, Body , InlineAsmOperand , Local , LocalKind , Location , Operand , Place , PlaceElem ,
115115 Rvalue , Statement , StatementKind , Terminator , TerminatorKind ,
116116} ;
117- use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
117+ use rustc_middle:: ty:: TyCtxt ;
118118
119119// Empirical measurements have resulted in some observations:
120120// - Running on a body with a single block and 500 locals takes barely any time
@@ -910,17 +910,8 @@ impl<'a, 'tcx> Visitor<'tcx> for FindAssignments<'a, 'tcx> {
910910
911911 // Handle the "subtle case" described above by rejecting any `dest` that is or
912912 // projects through a union.
913- let is_union = |ty : Ty < ' _ > | {
914- if let ty:: Adt ( def, _) = ty. kind ( ) {
915- if def. is_union ( ) {
916- return true ;
917- }
918- }
919-
920- false
921- } ;
922913 let mut place_ty = PlaceTy :: from_ty ( self . body . local_decls [ dest. local ] . ty ) ;
923- if is_union ( place_ty. ty ) {
914+ if place_ty. ty . is_union ( ) {
924915 return ;
925916 }
926917 for elem in dest. projection {
@@ -930,7 +921,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindAssignments<'a, 'tcx> {
930921 }
931922
932923 place_ty = place_ty. projection_ty ( self . tcx , elem) ;
933- if is_union ( place_ty. ty ) {
924+ if place_ty. ty . is_union ( ) {
934925 return ;
935926 }
936927 }
0 commit comments