Skip to content

Commit

Permalink
Remove Default derive from MacroExpectedFound.
Browse files Browse the repository at this point in the history
It's the only diagnostic in the entire project that impls `Default`, and
the code is clearer without it.
  • Loading branch information
nnethercote committed Mar 10, 2024
1 parent af69f4c commit 567744c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ pub(crate) struct ToolModuleImported {
#[diag(resolve_module_only)]
pub(crate) struct ModuleOnly(#[primary_span] pub(crate) Span);

#[derive(Diagnostic, Default)]
#[derive(Diagnostic)]
#[diag(resolve_macro_expected_found)]
pub(crate) struct MacroExpectedFound<'a> {
#[primary_span]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_resolve/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
expected,
found: res.descr(),
macro_path: &path_str,
..Default::default() // Subdiagnostics default to None
remove_surrounding_derive: None,
add_as_non_derive: None,
};

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

0 comments on commit 567744c

Please sign in to comment.