@@ -209,28 +209,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
209
209
block. unit ( )
210
210
}
211
211
212
- /// If we are changing the safety mode , create a new source scope
212
+ /// If we are entering an unsafe block , create a new source scope
213
213
fn update_source_scope_for_safety_mode ( & mut self , span : Span , safety_mode : BlockSafety ) {
214
214
debug ! ( "update_source_scope_for({:?}, {:?})" , span, safety_mode) ;
215
215
let new_unsafety = match safety_mode {
216
- BlockSafety :: Safe => None ,
217
- BlockSafety :: BuiltinUnsafe => Some ( Safety :: BuiltinUnsafe ) ,
216
+ BlockSafety :: Safe => return ,
217
+ BlockSafety :: BuiltinUnsafe => Safety :: BuiltinUnsafe ,
218
218
BlockSafety :: ExplicitUnsafe ( hir_id) => {
219
- match self . in_scope_unsafe {
220
- Safety :: Safe => { }
221
- // no longer treat `unsafe fn`s as `unsafe` contexts (see RFC #2585)
222
- Safety :: FnUnsafe
223
- if self . tcx . lint_level_at_node ( UNSAFE_OP_IN_UNSAFE_FN , hir_id) . 0
224
- != Level :: Allow => { }
225
- _ => return ,
226
- }
227
219
self . in_scope_unsafe = Safety :: ExplicitUnsafe ( hir_id) ;
228
- Some ( Safety :: ExplicitUnsafe ( hir_id) )
220
+ Safety :: ExplicitUnsafe ( hir_id)
229
221
}
230
222
} ;
231
223
232
- if let Some ( unsafety) = new_unsafety {
233
- self . source_scope = self . new_source_scope ( span, LintLevel :: Inherited , Some ( unsafety) ) ;
234
- }
224
+ self . source_scope = self . new_source_scope ( span, LintLevel :: Inherited , Some ( new_unsafety) ) ;
235
225
}
236
226
}
0 commit comments