rustc_bulltin_macros: tweak span_labels

This commit is contained in:
Mazdak Farrokhzad 2020-02-11 08:24:05 +01:00
parent 3341c94006
commit 27f60906aa

View File

@ -377,13 +377,13 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
if let ast::ItemKind::Fn(ref sig, ref generics, _) = i.kind { if let ast::ItemKind::Fn(ref sig, ref generics, _) = i.kind {
if let ast::Unsafe::Yes(span) = sig.header.unsafety { if let ast::Unsafe::Yes(span) = sig.header.unsafety {
sd.struct_span_err(i.span, "unsafe functions cannot be used for tests") sd.struct_span_err(i.span, "unsafe functions cannot be used for tests")
.span_label(span, "unsafe because of this") .span_label(span, "`unsafe` because of this")
.emit(); .emit();
return false; return false;
} }
if let ast::Async::Yes { span, .. } = sig.header.asyncness { if let ast::Async::Yes { span, .. } = sig.header.asyncness {
sd.struct_span_err(i.span, "async functions cannot be used for tests") sd.struct_span_err(i.span, "async functions cannot be used for tests")
.span_label(span, "async because of this") .span_label(span, "`async` because of this")
.emit(); .emit();
return false; return false;
} }