1
Fork 0

Removed test for unhandled case in function_item_references lint

Removed test for the unhandled case of calls to `fn f<T>(x: &T)` where `x` is a
function reference and is formatted as a pointer in `f`. This compiles since
`&T` implements `Pointer`, but is unlikely to occur in practice. Also tweaked
the lint's wording and modified tests accordingly.
This commit is contained in:
Ayrton 2020-10-06 11:59:14 -04:00
parent 511fe048b4
commit 432ebd57ef
3 changed files with 86 additions and 89 deletions

View file

@ -164,7 +164,7 @@ impl<'a, 'tcx> FunctionItemRefChecker<'a, 'tcx> {
let ret = if fn_sig.output().skip_binder().is_unit() { "" } else { " -> _" };
self.tcx.struct_span_lint_hir(FUNCTION_ITEM_REFERENCES, lint_root, span, |lint| {
lint.build(&format!(
"cast `{}` with `as {}{}fn({}{}){}` to use it as a pointer",
"cast `{}` with `as {}{}fn({}{}){}` to obtain a function pointer",
ident,
unsafety,
abi,