@@ -20,7 +20,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2020 ref stmts,
2121 expr,
2222 targeted_by_break,
23- safety_mode,
23+ safety_mode : _ ,
2424 } = self . thir [ ast_block] ;
2525 let expr = expr. map ( |expr| & self . thir [ expr] ) ;
2626 self . in_opt_scope ( opt_destruction_scope. map ( |de| ( de, source_info) ) , move |this| {
@@ -33,20 +33,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3333 span,
3434 & stmts,
3535 expr,
36- safety_mode,
3736 region_scope,
3837 ) )
3938 } )
4039 } else {
41- this. ast_block_stmts (
42- destination,
43- block,
44- span,
45- & stmts,
46- expr,
47- safety_mode,
48- region_scope,
49- )
40+ this. ast_block_stmts ( destination, block, span, & stmts, expr, region_scope)
5041 }
5142 } )
5243 } )
@@ -59,7 +50,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5950 span : Span ,
6051 stmts : & [ StmtId ] ,
6152 expr : Option < & Expr < ' tcx > > ,
62- safety_mode : BlockSafety ,
6353 region_scope : Scope ,
6454 ) -> BlockAnd < ( ) > {
6555 let this = self ;
@@ -82,13 +72,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8272 // First we build all the statements in the block.
8373 let mut let_scope_stack = Vec :: with_capacity ( 8 ) ;
8474 let outer_source_scope = this. source_scope ;
85- let outer_in_scope_unsafe = this. in_scope_unsafe ;
8675 // This scope information is kept for breaking out of the parent remainder scope in case
8776 // one let-else pattern matching fails.
8877 // By doing so, we can be sure that even temporaries that receive extended lifetime
8978 // assignments are dropped, too.
9079 let mut last_remainder_scope = region_scope;
91- this. update_source_scope_for_safety_mode ( span, safety_mode) ;
9280
9381 let source_info = this. source_info ( span) ;
9482 for stmt in stmts {
@@ -217,7 +205,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
217205 let_scope_stack. push ( remainder_scope) ;
218206
219207 let visibility_scope =
220- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
208+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
221209
222210 let init = & this. thir [ * initializer] ;
223211 let initializer_span = init. span ;
@@ -292,7 +280,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
292280 let remainder_span = remainder_scope. span ( this. tcx , this. region_scope_tree ) ;
293281
294282 let visibility_scope =
295- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
283+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
296284
297285 // Evaluate the initializer, if present.
298286 if let Some ( init) = initializer {
@@ -390,22 +378,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
390378 }
391379 // Restore the original source scope.
392380 this. source_scope = outer_source_scope;
393- this. in_scope_unsafe = outer_in_scope_unsafe;
394381 block. unit ( )
395382 }
396-
397- /// If we are entering an unsafe block, create a new source scope
398- fn update_source_scope_for_safety_mode ( & mut self , span : Span , safety_mode : BlockSafety ) {
399- debug ! ( "update_source_scope_for({:?}, {:?})" , span, safety_mode) ;
400- let new_unsafety = match safety_mode {
401- BlockSafety :: Safe => return ,
402- BlockSafety :: BuiltinUnsafe => Safety :: BuiltinUnsafe ,
403- BlockSafety :: ExplicitUnsafe ( hir_id) => {
404- self . in_scope_unsafe = Safety :: ExplicitUnsafe ( hir_id) ;
405- Safety :: ExplicitUnsafe ( hir_id)
406- }
407- } ;
408-
409- self . source_scope = self . new_source_scope ( span, LintLevel :: Inherited , Some ( new_unsafety) ) ;
410- }
411383}
0 commit comments