Try to render shorthand differently
This commit is contained in:
parent
33651f49a0
commit
1952b87780
2 changed files with 12 additions and 9 deletions
|
@ -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())));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue