@@ -990,17 +990,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
990
990
}
991
991
}
992
992
993
- /// A temporary that must be set like `let temp = Deref::deref(&place)` after the candidate
994
- /// `pre_binding_block`. This is because fake edges prevent us from keeping the temporaries we set
995
- /// up while testing which branch to take.
996
- #[ derive( Debug , Copy , Clone ) ]
997
- struct DerefTemporary < ' tcx > {
998
- place : Place < ' tcx > ,
999
- temp : Place < ' tcx > ,
1000
- ty : Ty < ' tcx > ,
1001
- span : Span ,
1002
- }
1003
-
1004
993
/// Data extracted from a pattern that doesn't affect which branch is taken. Collected during
1005
994
/// pattern simplification and not mutated later.
1006
995
#[ derive( Debug , Clone , Default ) ]
@@ -1013,15 +1002,12 @@ struct PatternExtraData<'tcx> {
1013
1002
1014
1003
/// Types that must be asserted.
1015
1004
ascriptions : Vec < Ascription < ' tcx > > ,
1016
-
1017
- /// Temporaries that must be set up in order.
1018
- deref_temps : Vec < DerefTemporary < ' tcx > > ,
1019
1005
}
1020
1006
1021
1007
impl < ' tcx > PatternExtraData < ' tcx > {
1022
1008
fn is_empty ( & self ) -> bool {
1023
1009
// FIXME(deref_patterns): can we merge trivial subcandidates that use deref patterns?
1024
- self . bindings . is_empty ( ) && self . ascriptions . is_empty ( ) && self . deref_temps . is_empty ( )
1010
+ self . bindings . is_empty ( ) && self . ascriptions . is_empty ( )
1025
1011
}
1026
1012
}
1027
1013
@@ -1048,7 +1034,6 @@ impl<'tcx, 'pat> FlatPat<'pat, 'tcx> {
1048
1034
span : pattern. span ,
1049
1035
bindings : Vec :: new ( ) ,
1050
1036
ascriptions : Vec :: new ( ) ,
1051
- deref_temps : Vec :: new ( ) ,
1052
1037
} ,
1053
1038
} ;
1054
1039
cx. simplify_match_pairs ( & mut flat_pat. match_pairs , & mut flat_pat. extra_data ) ;
@@ -2095,23 +2080,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2095
2080
block = fresh_block;
2096
2081
}
2097
2082
2098
- for d in collected_data. iter ( ) {
2099
- for deref_call in d. deref_temps . iter ( ) {
2100
- // Re-establish `Deref::deref` temporaries because false edges trick borrowck into
2101
- // believing they may not be initialized.
2102
- let next_block = self . cfg . start_new_block ( ) ;
2103
- self . call_deref (
2104
- block,
2105
- next_block,
2106
- deref_call. place ,
2107
- deref_call. ty ,
2108
- deref_call. temp ,
2109
- deref_call. span ,
2110
- ) ;
2111
- block = next_block;
2112
- }
2113
- }
2114
-
2115
2083
self . ascribe_types ( block, collected_data. iter ( ) . flat_map ( |d| & d. ascriptions ) . cloned ( ) ) ;
2116
2084
2117
2085
// rust-lang/rust#27282: The `autoref` business deserves some
0 commit comments