1
Fork 0

ADD - migrate InvalidTraitItem and AltInvalidTraitItem errors

Thought of doing this by having a struct and an enum with Default and Alt cases, but not sure if we wanted to have the text in code instead of having “demangling()” and “demangling-alt()” in the ftl file.

Don’t like the current way of having structs representing the same-ish and using long names to distinguish their expectations, instead of putting this in an enum and handling the different cases inside the type.

I am fine with whichever option the team prefers; also understand having them as separate structs keeps it simple.
This commit is contained in:
Jhonny Bill Mena 2022-08-21 00:38:23 -04:00
parent 86f8c4e8e3
commit 359002bbeb
3 changed files with 29 additions and 3 deletions

View file

@ -10,3 +10,19 @@ pub struct InvalidSymbolName<'a> {
pub span: Span,
pub mangled_formatted: &'a str,
}
#[derive(SessionDiagnostic)]
#[error(symbol_mangling::invalid_trait_item)]
pub struct InvalidTraitItem<'a> {
#[primary_span]
pub span: Span,
pub demangling_formatted: &'a str,
}
#[derive(SessionDiagnostic)]
#[error(symbol_mangling::alt_invalid_trait_item)]
pub struct AltInvalidTraitItem<'a> {
#[primary_span]
pub span: Span,
pub alt_demangling_formatted: &'a str,
}