File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
compiler/rustc_mir_build/src Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -72,16 +72,20 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
7272 SafetyContext :: UnsafeFn if unsafe_op_in_unsafe_fn_allowed => { }
7373 SafetyContext :: UnsafeFn => {
7474 // unsafe_op_in_unsafe_fn is disallowed
75- struct_span_err ! (
76- self . tcx. sess,
75+ self . tcx . struct_span_lint_hir (
76+ UNSAFE_OP_IN_UNSAFE_FN ,
77+ self . hir_context ,
7778 span,
78- E0133 ,
79- "{} is unsafe and requires unsafe block" ,
80- description,
79+ |lint| {
80+ lint. build ( & format ! (
81+ "{} is unsafe and requires unsafe block (error E0133)" ,
82+ description,
83+ ) )
84+ . span_label ( span, description)
85+ . note ( note)
86+ . emit ( ) ;
87+ } ,
8188 )
82- . span_label ( span, description)
83- . note ( note)
84- . emit ( ) ;
8589 }
8690 SafetyContext :: Safe => {
8791 let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" } ;
You can’t perform that action at this time.
0 commit comments