@@ -993,17 +993,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
993993 }
994994}
995995
996- /// A temporary that must be set like `let temp = Deref::deref(&place)` after the candidate
997- /// `pre_binding_block`. This is because fake edges prevent us from keeping the temporaries we set
998- /// up while testing which branch to take.
999- #[ derive( Debug , Copy , Clone ) ]
1000- struct DerefTemporary < ' tcx > {
1001- place : Place < ' tcx > ,
1002- temp : Place < ' tcx > ,
1003- ty : Ty < ' tcx > ,
1004- span : Span ,
1005- }
1006-
1007996/// Data extracted from a pattern that doesn't affect which branch is taken. Collected during
1008997/// pattern simplification and not mutated later.
1009998#[ derive( Debug , Clone , Default ) ]
@@ -1016,15 +1005,12 @@ struct PatternExtraData<'tcx> {
10161005
10171006 /// Types that must be asserted.
10181007 ascriptions : Vec < Ascription < ' tcx > > ,
1019-
1020- /// Temporaries that must be set up in order.
1021- deref_temps : Vec < DerefTemporary < ' tcx > > ,
10221008}
10231009
10241010impl < ' tcx > PatternExtraData < ' tcx > {
10251011 fn is_empty ( & self ) -> bool {
10261012 // FIXME(deref_patterns): can we merge trivial subcandidates that use deref patterns?
1027- self . bindings . is_empty ( ) && self . ascriptions . is_empty ( ) && self . deref_temps . is_empty ( )
1013+ self . bindings . is_empty ( ) && self . ascriptions . is_empty ( )
10281014 }
10291015}
10301016
@@ -1051,7 +1037,6 @@ impl<'tcx, 'pat> FlatPat<'pat, 'tcx> {
10511037 span : pattern. span ,
10521038 bindings : Vec :: new ( ) ,
10531039 ascriptions : Vec :: new ( ) ,
1054- deref_temps : Vec :: new ( ) ,
10551040 } ,
10561041 } ;
10571042 cx. simplify_match_pairs ( & mut flat_pat. match_pairs , & mut flat_pat. extra_data ) ;
@@ -2098,23 +2083,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
20982083 block = fresh_block;
20992084 }
21002085
2101- for d in collected_data. iter ( ) {
2102- for deref_call in d. deref_temps . iter ( ) {
2103- // Re-establish `Deref::deref` temporaries because false edges trick borrowck into
2104- // believing they may not be initialized.
2105- let next_block = self . cfg . start_new_block ( ) ;
2106- self . call_deref (
2107- block,
2108- next_block,
2109- deref_call. place ,
2110- deref_call. ty ,
2111- deref_call. temp ,
2112- deref_call. span ,
2113- ) ;
2114- block = next_block;
2115- }
2116- }
2117-
21182086 self . ascribe_types ( block, collected_data. iter ( ) . flat_map ( |d| & d. ascriptions ) . cloned ( ) ) ;
21192087
21202088 // rust-lang/rust#27282: The `autoref` business deserves some
0 commit comments