about summary refs log tree commit diff
path: root/compiler/rustc_macros/src
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-03-30 10:04:03 +0100
committerDavid Wood <david.wood@huawei.com>2022-04-05 07:01:03 +0100
commitf0de7df2048497cd701ee9a88ec44e9ac00e282e (patch)
treef6b6fd76d486afe5f66c1381d7f421db72eb6803 /compiler/rustc_macros/src
parenta52b5072ac9644ce4f8e336c9c1d79f7afe16f9f (diff)
downloadrust-f0de7df2048497cd701ee9a88ec44e9ac00e282e.tar.gz
rust-f0de7df2048497cd701ee9a88ec44e9ac00e282e.zip
macros: update session diagnostic errors
Small commit adding backticks around types and annotations in the error
messages from the session diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_macros/src')
-rw-r--r--compiler/rustc_macros/src/session_diagnostic.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_macros/src/session_diagnostic.rs b/compiler/rustc_macros/src/session_diagnostic.rs
index e5376418124..4430e1cdfc5 100644
--- a/compiler/rustc_macros/src/session_diagnostic.rs
+++ b/compiler/rustc_macros/src/session_diagnostic.rs
@@ -224,7 +224,7 @@ impl<'a> SessionDiagnosticDerive<'a> {
                 match builder.kind {
                     None => {
                         span_err(ast.span().unwrap(), "`code` not specified")
-                        .help("use the [code = \"...\"] attribute to set this diagnostic's error code ")
+                        .help("use the `#[code = \"...\"]` attribute to set this diagnostic's error code ")
                         .emit();
                         SessionDiagnosticDeriveError::ErrorHandled.to_compile_error()
                     }
@@ -338,7 +338,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                     other => throw_span_err!(
                         attr.span().unwrap(),
                         &format!(
-                            "`#[{} = ...]` is not a valid SessionDiagnostic struct attribute",
+                            "`#[{} = ...]` is not a valid `SessionDiagnostic` struct attribute",
                             other
                         )
                     ),
@@ -429,7 +429,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                         } else {
                             throw_span_err!(
                                 attr.span().unwrap(),
-                                "the `#[message = \"...\"]` attribute can only be applied to fields of type Span"
+                                "the `#[message = \"...\"]` attribute can only be applied to fields of type `Span`"
                             );
                         }
                     }
@@ -441,14 +441,14 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                         } else {
                             throw_span_err!(
                                 attr.span().unwrap(),
-                                "The `#[label = ...]` attribute can only be applied to fields of type Span"
+                                "The `#[label = ...]` attribute can only be applied to fields of type `Span`"
                             );
                         }
                     }
                     other => throw_span_err!(
                         attr.span().unwrap(),
                         &format!(
-                            "`#[{} = ...]` is not a valid SessionDiagnostic field attribute",
+                            "`#[{} = ...]` is not a valid `SessionDiagnostic` field attribute",
                             other
                         )
                     ),
@@ -505,7 +505,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                                 list.span().unwrap(),
                                 "missing suggestion message",
                                 |diag| {
-                                    diag.help("provide a suggestion message using #[suggestion(message = \"...\")]")
+                                    diag.help("provide a suggestion message using `#[suggestion(message = \"...\")]`")
                                 }
                             );
                         };
@@ -549,7 +549,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                         } else {
                             throw_span_err!(
                                 info.span.unwrap(),
-                                "type of field annotated with `#[suggestion(...)]` contains more than one Span"
+                                "type of field annotated with `#[suggestion(...)]` contains more than one `Span`"
                             );
                         }
                     } else if type_matches_path(elem, &["rustc_errors", "Applicability"]) {
@@ -575,12 +575,12 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
                 }
 
                 throw_span_err!(info.span.unwrap(), "wrong types for suggestion", |diag| {
-                    diag.help("#[suggestion(...)] on a tuple field must be applied to fields of type `(Span, Applicability)`")
+                    diag.help("`#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`")
                 });
             }
             // If `ty` isn't a `Span` or `(Span, Applicability)` then emit an error.
             _ => throw_span_err!(info.span.unwrap(), "wrong field type for suggestion", |diag| {
-                diag.help("#[suggestion(...)] should be applied to fields of type `Span` or `(Span, Applicability)`")
+                diag.help("`#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`")
             }),
         }
     }