Rollup merge of #62702 - fakenine:normalize_use_of_backticks_compiler_messages_p5, r=Centril

normalize use of backticks in compiler messages for libsyntax_ext

https://github.com/rust-lang/rust/issues/60532
This commit is contained in:
Mark Rousskov 2019-07-16 11:38:57 -04:00 committed by GitHub
commit 4226f14cbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -73,7 +73,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt<'_>,
} }
} }
_ => cx.span_bug(span, "#[derive(Clone)] on trait item or impl item"), _ => cx.span_bug(span, "`#[derive(Clone)]` on trait item or impl item"),
} }
let inline = cx.meta_word(span, sym::inline); let inline = cx.meta_word(span, sym::inline);

View file

@ -42,12 +42,12 @@ pub fn expand_test_or_bench(
if let Annotatable::Item(i) = item { i } if let Annotatable::Item(i) = item { i }
else { else {
cx.parse_sess.span_diagnostic.span_fatal(item.span(), cx.parse_sess.span_diagnostic.span_fatal(item.span(),
"#[test] attribute is only allowed on non associated functions").raise(); "`#[test]` attribute is only allowed on non associated functions").raise();
}; };
if let ast::ItemKind::Mac(_) = item.node { if let ast::ItemKind::Mac(_) = item.node {
cx.parse_sess.span_diagnostic.span_warn(item.span, cx.parse_sess.span_diagnostic.span_warn(item.span,
"#[test] attribute should not be used on macros. Use #[cfg(test)] instead."); "`#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead.");
return vec![Annotatable::Item(item)]; return vec![Annotatable::Item(item)];
} }
@ -167,7 +167,7 @@ pub fn expand_test_or_bench(
ast::ItemKind::ExternCrate(Some(sym::test)) ast::ItemKind::ExternCrate(Some(sym::test))
); );
log::debug!("Synthetic test item:\n{}\n", pprust::item_to_string(&test_const)); log::debug!("synthetic test item:\n{}\n", pprust::item_to_string(&test_const));
vec![ vec![
// Access to libtest under a gensymed name // Access to libtest under a gensymed name

View file

@ -6,7 +6,7 @@ struct A {}
impl A { impl A {
#[test] #[test]
fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions fn new() -> A { //~ ERROR `#[test]` attribute is only allowed on non associated functions
A {} A {}
} }
} }

View file

@ -1,4 +1,4 @@
error: #[test] attribute is only allowed on non associated functions error: `#[test]` attribute is only allowed on non associated functions
--> $DIR/test-attr-non-associated-functions.rs:9:5 --> $DIR/test-attr-non-associated-functions.rs:9:5
| |
LL | / fn new() -> A { LL | / fn new() -> A {

View file

@ -1,4 +1,4 @@
warning: #[test] attribute should not be used on macros. Use #[cfg(test)] instead. warning: `#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead.
--> $DIR/test-on-macro.rs:11:1 --> $DIR/test-on-macro.rs:11:1
| |
LL | foo!(); LL | foo!();