Skip to content

Commit 567744c

Browse files
committed
Remove Default derive from MacroExpectedFound.
It's the only diagnostic in the entire project that impls `Default`, and the code is clearer without it.
1 parent af69f4c commit 567744c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/rustc_resolve/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ pub(crate) struct ToolModuleImported {
521521
#[diag(resolve_module_only)]
522522
pub(crate) struct ModuleOnly(#[primary_span] pub(crate) Span);
523523

524-
#[derive(Diagnostic, Default)]
524+
#[derive(Diagnostic)]
525525
#[diag(resolve_macro_expected_found)]
526526
pub(crate) struct MacroExpectedFound<'a> {
527527
#[primary_span]

compiler/rustc_resolve/src/macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
562562
expected,
563563
found: res.descr(),
564564
macro_path: &path_str,
565-
..Default::default() // Subdiagnostics default to None
565+
remove_surrounding_derive: None,
566+
add_as_non_derive: None,
566567
};
567568

568569
// Suggest moving the macro out of the derive() if the macro isn't Derive

0 commit comments

Comments
 (0)