diff options
| author | Lin Yihai <linyihai@huawei.com> | 2024-07-10 10:59:33 +0800 |
|---|---|---|
| committer | Lin Yihai <linyihai@huawei.com> | 2024-07-26 10:51:55 +0800 |
| commit | 2fca4ea317f2f45a9a6f8272e52661807b100ca3 (patch) | |
| tree | 9aaa1348a58fb8a6863ccf6d52ccd4bba1f9015d /compiler/rustc_resolve/src | |
| parent | 5be2ec7245de6e8015a0daedf24d20e3e5bf2062 (diff) | |
| download | rust-2fca4ea317f2f45a9a6f8272e52661807b100ca3.tar.gz rust-2fca4ea317f2f45a9a6f8272e52661807b100ca3.zip | |
Add a label to point to the lacking macro name definition
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/errors.rs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index ffd495aa985..28a3698c080 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1439,7 +1439,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ); if macro_kind == MacroKind::Bang && ident.name == sym::macro_rules { - err.subdiagnostic(MaybeMissingMacroRulesName { span: ident.span }); + let label_span = ident.span.shrink_to_hi(); + let mut spans = MultiSpan::from_span(label_span); + spans.push_span_label(label_span, "put a macro name here"); + err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans }); return; } diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 0620f3d709e..5bcb2badd95 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -667,7 +667,7 @@ pub(crate) struct MacroSuggMovePosition { #[note(resolve_missing_macro_rules_name)] pub(crate) struct MaybeMissingMacroRulesName { #[primary_span] - pub(crate) span: Span, + pub(crate) spans: MultiSpan, } #[derive(Subdiagnostic)] |
