diff options
| author | Nikita Tomashevich <quant3234@gmail.com> | 2022-09-05 19:04:35 +0300 |
|---|---|---|
| committer | Nikita Tomashevich <quant3234@gmail.com> | 2022-09-06 18:41:09 +0300 |
| commit | 59c567296a8dd2b6c36765dbb14caf68cc9cf9af (patch) | |
| tree | 1a88e47327714e7f36689cc4b34f92d20082cc18 /compiler/rustc_infer/src/errors | |
| parent | e750d7faa7e18fb3af51de96b35baebcce4123a2 (diff) | |
| download | rust-59c567296a8dd2b6c36765dbb14caf68cc9cf9af.tar.gz rust-59c567296a8dd2b6c36765dbb14caf68cc9cf9af.zip | |
Use untranslated messages for now
Diffstat (limited to 'compiler/rustc_infer/src/errors')
| -rw-r--r-- | compiler/rustc_infer/src/errors/mod.rs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index e191147cdfe..911381b367f 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -448,18 +448,31 @@ impl AddSubdiagnostic for ImplNote { } } -#[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)] |
