@@ -2059,14 +2059,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2059
2059
return self . cfg . start_new_block ( ) ;
2060
2060
}
2061
2061
2062
- self . ascribe_types (
2063
- block,
2064
- parent_data
2065
- . iter ( )
2066
- . flat_map ( |d| & d. ascriptions )
2067
- . cloned ( )
2068
- . chain ( candidate. extra_data . ascriptions ) ,
2069
- ) ;
2062
+ let ascriptions = parent_data
2063
+ . iter ( )
2064
+ . flat_map ( |d| & d. ascriptions )
2065
+ . cloned ( )
2066
+ . chain ( candidate. extra_data . ascriptions ) ;
2067
+ let bindings =
2068
+ parent_data. iter ( ) . flat_map ( |d| & d. bindings ) . chain ( & candidate. extra_data . bindings ) ;
2069
+
2070
+ self . ascribe_types ( block, ascriptions) ;
2070
2071
2071
2072
// rust-lang/rust#27282: The `autoref` business deserves some
2072
2073
// explanation here.
@@ -2153,12 +2154,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2153
2154
&& let Some ( guard) = arm. guard
2154
2155
{
2155
2156
let tcx = self . tcx ;
2156
- let bindings =
2157
- parent_data. iter ( ) . flat_map ( |d| & d. bindings ) . chain ( & candidate. extra_data . bindings ) ;
2158
2157
2159
2158
self . bind_matched_candidate_for_guard ( block, schedule_drops, bindings. clone ( ) ) ;
2160
- let guard_frame =
2161
- GuardFrame { locals : bindings. map ( |b| GuardFrameLocal :: new ( b. var_id ) ) . collect ( ) } ;
2159
+ let guard_frame = GuardFrame {
2160
+ locals : bindings. clone ( ) . map ( |b| GuardFrameLocal :: new ( b. var_id ) ) . collect ( ) ,
2161
+ } ;
2162
2162
debug ! ( "entering guard building context: {:?}" , guard_frame) ;
2163
2163
self . guard_context . push ( guard_frame) ;
2164
2164
@@ -2231,11 +2231,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2231
2231
// ```
2232
2232
//
2233
2233
// and that is clearly not correct.
2234
- let by_value_bindings = parent_data
2235
- . iter ( )
2236
- . flat_map ( |d| & d. bindings )
2237
- . chain ( & candidate. extra_data . bindings )
2238
- . filter ( |binding| matches ! ( binding. binding_mode. 0 , ByRef :: No ) ) ;
2234
+ let by_value_bindings =
2235
+ bindings. filter ( |binding| matches ! ( binding. binding_mode. 0 , ByRef :: No ) ) ;
2239
2236
// Read all of the by reference bindings to ensure that the
2240
2237
// place they refer to can't be modified by the guard.
2241
2238
for binding in by_value_bindings. clone ( ) {
@@ -2259,7 +2256,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2259
2256
self . bind_matched_candidate_for_arm_body (
2260
2257
block,
2261
2258
schedule_drops,
2262
- parent_data . iter ( ) . flat_map ( |d| & d . bindings ) . chain ( & candidate . extra_data . bindings ) ,
2259
+ bindings,
2263
2260
storages_alive,
2264
2261
) ;
2265
2262
block
0 commit comments