File tree Expand file tree Collapse file tree 1 file changed +24
-11
lines changed
compiler/rustc_infer/src/errors Expand file tree Collapse file tree 1 file changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -448,18 +448,31 @@ impl AddSubdiagnostic for ImplNote {
448448 }
449449}
450450
451- #[ derive( SessionSubdiagnostic ) ]
452451pub enum TraitSubdiag {
453- #[ note( infer:: msl_trait_note) ]
454- Note {
455- #[ primary_span]
456- span : Span ,
457- } ,
458- #[ suggestion_verbose( infer:: msl_trait_sugg, code = " + '_" , applicability = "maybe-incorrect" ) ]
459- Sugg {
460- #[ primary_span]
461- span : Span ,
462- } ,
452+ Note { span : Span } ,
453+ Sugg { span : Span } ,
454+ }
455+
456+ // FIXME We can't rely on Vec<Subdiag> working well at the moment,
457+ // as only the args from one of the subdiagnostics will actually be used.
458+ // This results in an incorrect diagnostic if more than two subdiags with the same slug are added.
459+ // Use untranslated messages for now.
460+ impl AddSubdiagnostic for TraitSubdiag {
461+ fn add_to_diagnostic ( self , diag : & mut rustc_errors:: Diagnostic ) {
462+ match self {
463+ TraitSubdiag :: Note { span } => {
464+ diag. span_note ( span, "this has an implicit `'static` lifetime requirement" ) ;
465+ }
466+ TraitSubdiag :: Sugg { span } => {
467+ diag. span_suggestion_verbose (
468+ span,
469+ "consider relaxing the implicit `'static` requirement" ,
470+ " + '_" . to_owned ( ) ,
471+ rustc_errors:: Applicability :: MaybeIncorrect ,
472+ ) ;
473+ }
474+ }
475+ }
463476}
464477
465478#[ derive( SessionDiagnostic ) ]
You can’t perform that action at this time.
0 commit comments