Rollup merge of #95663 - notriddle:notriddle/unsafe-fn-closure, r=compiler-errors
diagnostics: give a special note for unsafe fn / Fn/FnOnce/FnMut Fixes #90073
This commit is contained in:
commit
1e555bac14
6 changed files with 44 additions and 10 deletions
|
@ -208,6 +208,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
flags.push((sym::_Self, Some("&[]".to_owned())));
|
||||
}
|
||||
|
||||
if self_ty.is_fn() {
|
||||
let fn_sig = self_ty.fn_sig(self.tcx);
|
||||
let shortname = match fn_sig.unsafety() {
|
||||
hir::Unsafety::Normal => "fn",
|
||||
hir::Unsafety::Unsafe => "unsafe fn",
|
||||
};
|
||||
flags.push((sym::_Self, Some(shortname.to_owned())));
|
||||
}
|
||||
|
||||
if let ty::Array(aty, len) = self_ty.kind() {
|
||||
flags.push((sym::_Self, Some("[]".to_owned())));
|
||||
flags.push((sym::_Self, Some(format!("[{}]", aty))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue