@@ -13,31 +13,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1313 ast_block : BlockId ,
1414 source_info : SourceInfo ,
1515 ) -> BlockAnd < ( ) > {
16- let Block { region_scope, span, ref stmts, expr, targeted_by_break, safety_mode } =
16+ let Block { region_scope, span, ref stmts, expr, targeted_by_break, safety_mode : _ } =
1717 self . thir [ ast_block] ;
1818 self . in_scope ( ( region_scope, source_info) , LintLevel :: Inherited , move |this| {
1919 if targeted_by_break {
2020 this. in_breakable_scope ( None , destination, span, |this| {
21- Some ( this. ast_block_stmts (
22- destination,
23- block,
24- span,
25- stmts,
26- expr,
27- safety_mode,
28- region_scope,
29- ) )
21+ Some ( this. ast_block_stmts ( destination, block, span, stmts, expr, region_scope) )
3022 } )
3123 } else {
32- this. ast_block_stmts (
33- destination,
34- block,
35- span,
36- stmts,
37- expr,
38- safety_mode,
39- region_scope,
40- )
24+ this. ast_block_stmts ( destination, block, span, stmts, expr, region_scope)
4125 }
4226 } )
4327 }
@@ -49,7 +33,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
4933 span : Span ,
5034 stmts : & [ StmtId ] ,
5135 expr : Option < ExprId > ,
52- safety_mode : BlockSafety ,
5336 region_scope : Scope ,
5437 ) -> BlockAnd < ( ) > {
5538 let this = self ;
@@ -72,13 +55,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7255 // First we build all the statements in the block.
7356 let mut let_scope_stack = Vec :: with_capacity ( 8 ) ;
7457 let outer_source_scope = this. source_scope ;
75- let outer_in_scope_unsafe = this. in_scope_unsafe ;
7658 // This scope information is kept for breaking out of the parent remainder scope in case
7759 // one let-else pattern matching fails.
7860 // By doing so, we can be sure that even temporaries that receive extended lifetime
7961 // assignments are dropped, too.
8062 let mut last_remainder_scope = region_scope;
81- this. update_source_scope_for_safety_mode ( span, safety_mode) ;
8263
8364 let source_info = this. source_info ( span) ;
8465 for stmt in stmts {
@@ -202,7 +183,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
202183 let_scope_stack. push ( remainder_scope) ;
203184
204185 let visibility_scope =
205- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
186+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
206187
207188 let initializer_span = this. thir [ * initializer] . span ;
208189 let scope = ( * init_scope, source_info) ;
@@ -271,7 +252,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
271252 let remainder_span = remainder_scope. span ( this. tcx , this. region_scope_tree ) ;
272253
273254 let visibility_scope =
274- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
255+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
275256
276257 // Evaluate the initializer, if present.
277258 if let Some ( init) = * initializer {
@@ -364,22 +345,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
364345 }
365346 // Restore the original source scope.
366347 this. source_scope = outer_source_scope;
367- this. in_scope_unsafe = outer_in_scope_unsafe;
368348 block. unit ( )
369349 }
370-
371- /// If we are entering an unsafe block, create a new source scope
372- fn update_source_scope_for_safety_mode ( & mut self , span : Span , safety_mode : BlockSafety ) {
373- debug ! ( "update_source_scope_for({:?}, {:?})" , span, safety_mode) ;
374- let new_unsafety = match safety_mode {
375- BlockSafety :: Safe => return ,
376- BlockSafety :: BuiltinUnsafe => Safety :: BuiltinUnsafe ,
377- BlockSafety :: ExplicitUnsafe ( hir_id) => {
378- self . in_scope_unsafe = Safety :: ExplicitUnsafe ( hir_id) ;
379- Safety :: ExplicitUnsafe ( hir_id)
380- }
381- } ;
382-
383- self . source_scope = self . new_source_scope ( span, LintLevel :: Inherited , Some ( new_unsafety) ) ;
384- }
385350}
0 commit comments