Remove unreachable and untested suggestion for invalid span enum derive(Default)
This commit is contained in:
parent
db613750a9
commit
2027e989bc
@ -60,9 +60,6 @@ resolve_change_import_binding =
|
||||
resolve_consider_adding_a_derive =
|
||||
consider adding a derive
|
||||
|
||||
resolve_consider_adding_a_derive_enum =
|
||||
consider adding `#[derive(Default)]` to this enum
|
||||
|
||||
resolve_const_not_member_of_trait =
|
||||
const `{$const_}` is not a member of trait `{$trait_}`
|
||||
.label = not a member of trait `{$trait_}`
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
use crate::errors::{
|
||||
AddedMacroUse, ChangeImportBinding, ChangeImportBindingSuggestion, ConsiderAddingADerive,
|
||||
ConsiderAddingADeriveEnum, ExplicitUnsafeTraits,
|
||||
ExplicitUnsafeTraits,
|
||||
};
|
||||
use crate::imports::{Import, ImportKind};
|
||||
use crate::late::{PatternSource, Rib};
|
||||
@ -1393,14 +1393,10 @@ pub(crate) fn unresolved_macro_suggestions(
|
||||
let span = self.def_span(def_id);
|
||||
let source_map = self.tcx.sess.source_map();
|
||||
let head_span = source_map.guess_head_span(span);
|
||||
if let Ok(head) = source_map.span_to_snippet(head_span) {
|
||||
err.subdiagnostic(ConsiderAddingADerive {
|
||||
span: head_span,
|
||||
suggestion: format!("#[derive(Default)]\n{head}")
|
||||
});
|
||||
} else {
|
||||
err.subdiagnostic(ConsiderAddingADeriveEnum { span: head_span });
|
||||
}
|
||||
err.subdiagnostic(ConsiderAddingADerive {
|
||||
span: head_span.shrink_to_lo(),
|
||||
suggestion: format!("#[derive(Default)]\n")
|
||||
});
|
||||
}
|
||||
for ns in [Namespace::MacroNS, Namespace::TypeNS, Namespace::ValueNS] {
|
||||
if let Ok(binding) = self.early_resolve_ident_in_lexical_scope(
|
||||
|
@ -646,10 +646,3 @@ pub(crate) struct ConsiderAddingADerive {
|
||||
pub(crate) span: Span,
|
||||
pub(crate) suggestion: String,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(resolve_consider_adding_a_derive_enum)]
|
||||
pub(crate) struct ConsiderAddingADeriveEnum {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ LL | #[default]
|
||||
help: consider adding a derive
|
||||
|
|
||||
LL + #[derive(Default)]
|
||||
LL ~ pub enum Test {
|
||||
LL | pub enum Test {
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user