Use untranslated messages for now

This commit is contained in:
Nikita Tomashevich 2022-09-05 19:04:35 +03:00
parent e750d7faa7
commit 59c567296a
No known key found for this signature in database
GPG Key ID: B29791D4D878E345

View File

@ -448,18 +448,31 @@ fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
}
}
#[derive(SessionSubdiagnostic)]
pub enum TraitSubdiag {
#[note(infer::msl_trait_note)]
Note {
#[primary_span]
span: Span,
},
#[suggestion_verbose(infer::msl_trait_sugg, code = " + '_", applicability = "maybe-incorrect")]
Sugg {
#[primary_span]
span: Span,
},
Note { span: Span },
Sugg { span: Span },
}
// FIXME We can't rely on Vec<Subdiag> working well at the moment,
// as only the args from one of the subdiagnostics will actually be used.
// This results in an incorrect diagnostic if more than two subdiags with the same slug are added.
// Use untranslated messages for now.
impl AddSubdiagnostic for TraitSubdiag {
fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
match self {
TraitSubdiag::Note { span } => {
diag.span_note(span, "this has an implicit `'static` lifetime requirement");
}
TraitSubdiag::Sugg { span } => {
diag.span_suggestion_verbose(
span,
"consider relaxing the implicit `'static` requirement",
" + '_".to_owned(),
rustc_errors::Applicability::MaybeIncorrect,
);
}
}
}
}
#[derive(SessionDiagnostic)]