@@ -993,17 +993,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
993
993
}
994
994
}
995
995
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
-
1007
996
/// Data extracted from a pattern that doesn't affect which branch is taken. Collected during
1008
997
/// pattern simplification and not mutated later.
1009
998
#[ derive( Debug , Clone , Default ) ]
@@ -1016,15 +1005,12 @@ struct PatternExtraData<'tcx> {
1016
1005
1017
1006
/// Types that must be asserted.
1018
1007
ascriptions : Vec < Ascription < ' tcx > > ,
1019
-
1020
- /// Temporaries that must be set up in order.
1021
- deref_temps : Vec < DerefTemporary < ' tcx > > ,
1022
1008
}
1023
1009
1024
1010
impl < ' tcx > PatternExtraData < ' tcx > {
1025
1011
fn is_empty ( & self ) -> bool {
1026
1012
// 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 ( )
1028
1014
}
1029
1015
}
1030
1016
@@ -1051,7 +1037,6 @@ impl<'tcx, 'pat> FlatPat<'pat, 'tcx> {
1051
1037
span : pattern. span ,
1052
1038
bindings : Vec :: new ( ) ,
1053
1039
ascriptions : Vec :: new ( ) ,
1054
- deref_temps : Vec :: new ( ) ,
1055
1040
} ,
1056
1041
} ;
1057
1042
cx. simplify_match_pairs ( & mut flat_pat. match_pairs , & mut flat_pat. extra_data ) ;
@@ -2098,23 +2083,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2098
2083
block = fresh_block;
2099
2084
}
2100
2085
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
-
2118
2086
self . ascribe_types ( block, collected_data. iter ( ) . flat_map ( |d| & d. ascriptions ) . cloned ( ) ) ;
2119
2087
2120
2088
// rust-lang/rust#27282: The `autoref` business deserves some
0 commit comments