File tree 1 file changed +12
-8
lines changed
compiler/rustc_mir_build/src
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> {
72
72
SafetyContext :: UnsafeFn if unsafe_op_in_unsafe_fn_allowed => { }
73
73
SafetyContext :: UnsafeFn => {
74
74
// 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 ,
77
78
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
+ } ,
81
88
)
82
- . span_label ( span, description)
83
- . note ( note)
84
- . emit ( ) ;
85
89
}
86
90
SafetyContext :: Safe => {
87
91
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