@@ -2073,14 +2073,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2073
2073
return self . cfg . start_new_block ( ) ;
2074
2074
}
2075
2075
2076
- self . ascribe_types (
2077
- block,
2078
- parent_data
2079
- . iter ( )
2080
- . flat_map ( |d| & d. ascriptions )
2081
- . cloned ( )
2082
- . chain ( candidate. extra_data . ascriptions ) ,
2083
- ) ;
2076
+ let ascriptions = parent_data
2077
+ . iter ( )
2078
+ . flat_map ( |d| & d. ascriptions )
2079
+ . cloned ( )
2080
+ . chain ( candidate. extra_data . ascriptions ) ;
2081
+ let bindings =
2082
+ parent_data. iter ( ) . flat_map ( |d| & d. bindings ) . chain ( & candidate. extra_data . bindings ) ;
2083
+
2084
+ self . ascribe_types ( block, ascriptions) ;
2084
2085
2085
2086
// rust-lang/rust#27282: The `autoref` business deserves some
2086
2087
// explanation here.
@@ -2167,12 +2168,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2167
2168
&& let Some ( guard) = arm. guard
2168
2169
{
2169
2170
let tcx = self . tcx ;
2170
- let bindings =
2171
- parent_data. iter ( ) . flat_map ( |d| & d. bindings ) . chain ( & candidate. extra_data . bindings ) ;
2172
2171
2173
2172
self . bind_matched_candidate_for_guard ( block, schedule_drops, bindings. clone ( ) ) ;
2174
- let guard_frame =
2175
- GuardFrame { locals : bindings. map ( |b| GuardFrameLocal :: new ( b. var_id ) ) . collect ( ) } ;
2173
+ let guard_frame = GuardFrame {
2174
+ locals : bindings. clone ( ) . map ( |b| GuardFrameLocal :: new ( b. var_id ) ) . collect ( ) ,
2175
+ } ;
2176
2176
debug ! ( "entering guard building context: {:?}" , guard_frame) ;
2177
2177
self . guard_context . push ( guard_frame) ;
2178
2178
@@ -2245,11 +2245,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2245
2245
// ```
2246
2246
//
2247
2247
// and that is clearly not correct.
2248
- let by_value_bindings = parent_data
2249
- . iter ( )
2250
- . flat_map ( |d| & d. bindings )
2251
- . chain ( & candidate. extra_data . bindings )
2252
- . filter ( |binding| matches ! ( binding. binding_mode. 0 , ByRef :: No ) ) ;
2248
+ let by_value_bindings =
2249
+ bindings. filter ( |binding| matches ! ( binding. binding_mode. 0 , ByRef :: No ) ) ;
2253
2250
// Read all of the by reference bindings to ensure that the
2254
2251
// place they refer to can't be modified by the guard.
2255
2252
for binding in by_value_bindings. clone ( ) {
@@ -2273,7 +2270,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2273
2270
self . bind_matched_candidate_for_arm_body (
2274
2271
block,
2275
2272
schedule_drops,
2276
- parent_data . iter ( ) . flat_map ( |d| & d . bindings ) . chain ( & candidate . extra_data . bindings ) ,
2273
+ bindings,
2277
2274
storages_alive,
2278
2275
) ;
2279
2276
block
0 commit comments