summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_macros/src/diagnostics/diagnostic.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /compiler/rustc_macros/src/diagnostics/diagnostic.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_macros/src/diagnostics/diagnostic.rs')
-rw-r--r--compiler/rustc_macros/src/diagnostics/diagnostic.rs38
1 files changed, 20 insertions, 18 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic.rs b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
index 04b7c5fee..1a8174bfd 100644
--- a/compiler/rustc_macros/src/diagnostics/diagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
@@ -42,19 +42,20 @@ impl<'a> DiagnosticDerive<'a> {
let init = match builder.slug.value_ref() {
None => {
span_err(builder.span, "diagnostic slug not specified")
- .help("specify the slug as the first argument to the `#[diag(...)]` \
- attribute, such as `#[diag(hir_analysis_example_error)]`")
+ .help(
+ "specify the slug as the first argument to the `#[diag(...)]` \
+ attribute, such as `#[diag(hir_analysis_example_error)]`",
+ )
.emit();
return DiagnosticDeriveError::ErrorHandled.to_compile_error();
}
- Some(slug) if let Some( Mismatch { slug_name, crate_name, slug_prefix }) = Mismatch::check(slug) => {
+ Some(slug)
+ if let Some(Mismatch { slug_name, crate_name, slug_prefix }) =
+ Mismatch::check(slug) =>
+ {
span_err(slug.span().unwrap(), "diagnostic slug and crate name do not match")
- .note(format!(
- "slug is `{slug_name}` but the crate name is `{crate_name}`"
- ))
- .help(format!(
- "expected a slug starting with `{slug_prefix}_...`"
- ))
+ .note(format!("slug is `{slug_name}` but the crate name is `{crate_name}`"))
+ .help(format!("expected a slug starting with `{slug_prefix}_...`"))
.emit();
return DiagnosticDeriveError::ErrorHandled.to_compile_error();
}
@@ -141,19 +142,20 @@ impl<'a> LintDiagnosticDerive<'a> {
match builder.slug.value_ref() {
None => {
span_err(builder.span, "diagnostic slug not specified")
- .help("specify the slug as the first argument to the attribute, such as \
- `#[diag(compiletest_example)]`")
+ .help(
+ "specify the slug as the first argument to the attribute, such as \
+ `#[diag(compiletest_example)]`",
+ )
.emit();
DiagnosticDeriveError::ErrorHandled.to_compile_error()
}
- Some(slug) if let Some( Mismatch { slug_name, crate_name, slug_prefix }) = Mismatch::check(slug) => {
+ Some(slug)
+ if let Some(Mismatch { slug_name, crate_name, slug_prefix }) =
+ Mismatch::check(slug) =>
+ {
span_err(slug.span().unwrap(), "diagnostic slug and crate name do not match")
- .note(format!(
- "slug is `{slug_name}` but the crate name is `{crate_name}`"
- ))
- .help(format!(
- "expected a slug starting with `{slug_prefix}_...`"
- ))
+ .note(format!("slug is `{slug_name}` but the crate name is `{crate_name}`"))
+ .help(format!("expected a slug starting with `{slug_prefix}_...`"))
.emit();
DiagnosticDeriveError::ErrorHandled.to_compile_error()
}