Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic renaming 3 #122132

Merged
merged 8 commits into from
Mar 11, 2024
Merged
Next Next commit
Remove Default derive from MacroExpectedFound.
It's the only diagnostic in the entire project that impls `Default`, and
the code is clearer without it.
nnethercote committed Mar 10, 2024
commit 567744c10ea7306d57ebee7d87d9999711de7c84
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
@@ -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]
3 changes: 2 additions & 1 deletion compiler/rustc_resolve/src/macros.rs
Original file line number Diff line number Diff line change
@@ -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