@@ -2059,14 +2059,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
20592059 return self . cfg . start_new_block ( ) ;
20602060 }
20612061
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) ;
20702071
20712072 // rust-lang/rust#27282: The `autoref` business deserves some
20722073 // explanation here.
@@ -2153,12 +2154,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
21532154 && let Some ( guard) = arm. guard
21542155 {
21552156 let tcx = self . tcx ;
2156- let bindings =
2157- parent_data. iter ( ) . flat_map ( |d| & d. bindings ) . chain ( & candidate. extra_data . bindings ) ;
21582157
21592158 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+ } ;
21622162 debug ! ( "entering guard building context: {:?}" , guard_frame) ;
21632163 self . guard_context . push ( guard_frame) ;
21642164
@@ -2231,11 +2231,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
22312231 // ```
22322232 //
22332233 // 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 ) ) ;
22392236 // Read all of the by reference bindings to ensure that the
22402237 // place they refer to can't be modified by the guard.
22412238 for binding in by_value_bindings. clone ( ) {
@@ -2259,7 +2256,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
22592256 self . bind_matched_candidate_for_arm_body (
22602257 block,
22612258 schedule_drops,
2262- parent_data . iter ( ) . flat_map ( |d| & d . bindings ) . chain ( & candidate . extra_data . bindings ) ,
2259+ bindings,
22632260 storages_alive,
22642261 ) ;
22652262 block
0 commit comments