@@ -209,28 +209,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
209209 block. unit ( )
210210 }
211211
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
213213 fn update_source_scope_for_safety_mode ( & mut self , span : Span , safety_mode : BlockSafety ) {
214214 debug ! ( "update_source_scope_for({:?}, {:?})" , span, safety_mode) ;
215215 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 ,
218218 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- }
227219 self . in_scope_unsafe = Safety :: ExplicitUnsafe ( hir_id) ;
228- Some ( Safety :: ExplicitUnsafe ( hir_id) )
220+ Safety :: ExplicitUnsafe ( hir_id)
229221 }
230222 } ;
231223
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) ) ;
235225 }
236226}
0 commit comments