Avoid notes that only make sense for unsafe functions
This commit is contained in:
parent
1952b87780
commit
767d4fe64e
4 changed files with 9 additions and 17 deletions
|
@ -461,9 +461,11 @@ impl<T> Trait<T> for X {
|
|||
(ty::FnPtr(_, hdr), ty::FnDef(def_id, _))
|
||||
| (ty::FnDef(def_id, _), ty::FnPtr(_, hdr)) => {
|
||||
if tcx.fn_sig(def_id).skip_binder().safety() < hdr.safety {
|
||||
diag.note(
|
||||
if !tcx.codegen_fn_attrs(def_id).safe_target_features {
|
||||
diag.note(
|
||||
"unsafe functions cannot be coerced into safe function pointers",
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
(ty::Adt(_, _), ty::Adt(def, args))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue