@@ -13,31 +13,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13
13
ast_block : BlockId ,
14
14
source_info : SourceInfo ,
15
15
) -> 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 : _ } =
17
17
self . thir [ ast_block] ;
18
18
self . in_scope ( ( region_scope, source_info) , LintLevel :: Inherited , move |this| {
19
19
if targeted_by_break {
20
20
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) )
30
22
} )
31
23
} 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)
41
25
}
42
26
} )
43
27
}
@@ -49,7 +33,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
49
33
span : Span ,
50
34
stmts : & [ StmtId ] ,
51
35
expr : Option < ExprId > ,
52
- safety_mode : BlockSafety ,
53
36
region_scope : Scope ,
54
37
) -> BlockAnd < ( ) > {
55
38
let this = self ;
@@ -72,13 +55,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
72
55
// First we build all the statements in the block.
73
56
let mut let_scope_stack = Vec :: with_capacity ( 8 ) ;
74
57
let outer_source_scope = this. source_scope ;
75
- let outer_in_scope_unsafe = this. in_scope_unsafe ;
76
58
// This scope information is kept for breaking out of the parent remainder scope in case
77
59
// one let-else pattern matching fails.
78
60
// By doing so, we can be sure that even temporaries that receive extended lifetime
79
61
// assignments are dropped, too.
80
62
let mut last_remainder_scope = region_scope;
81
- this. update_source_scope_for_safety_mode ( span, safety_mode) ;
82
63
83
64
let source_info = this. source_info ( span) ;
84
65
for stmt in stmts {
@@ -202,7 +183,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
202
183
let_scope_stack. push ( remainder_scope) ;
203
184
204
185
let visibility_scope =
205
- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
186
+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
206
187
207
188
let initializer_span = this. thir [ * initializer] . span ;
208
189
let scope = ( * init_scope, source_info) ;
@@ -271,7 +252,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
271
252
let remainder_span = remainder_scope. span ( this. tcx , this. region_scope_tree ) ;
272
253
273
254
let visibility_scope =
274
- Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited , None ) ) ;
255
+ Some ( this. new_source_scope ( remainder_span, LintLevel :: Inherited ) ) ;
275
256
276
257
// Evaluate the initializer, if present.
277
258
if let Some ( init) = * initializer {
@@ -364,22 +345,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
364
345
}
365
346
// Restore the original source scope.
366
347
this. source_scope = outer_source_scope;
367
- this. in_scope_unsafe = outer_in_scope_unsafe;
368
348
block. unit ( )
369
349
}
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
- }
385
350
}
0 commit comments