1
Fork 0

Try to render shorthand differently

This commit is contained in:
Oli Scherer 2024-12-15 20:26:18 +00:00
parent 33651f49a0
commit 1952b87780
2 changed files with 12 additions and 9 deletions

View file

@ -205,9 +205,15 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
if self_ty.is_fn() {
let fn_sig = self_ty.fn_sig(self.tcx);
let shortname = match fn_sig.safety() {
hir::Safety::Safe => "fn",
hir::Safety::Unsafe => "unsafe fn",
let shortname = if let ty::FnDef(def_id, _) = self_ty.kind()
&& self.tcx.codegen_fn_attrs(def_id).safe_target_features
{
"#[target_feature] fn"
} else {
match fn_sig.safety() {
hir::Safety::Safe => "fn",
hir::Safety::Unsafe => "unsafe fn",
}
};
flags.push((sym::_Self, Some(shortname.to_owned())));
}