File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
compiler/rustc_macros/src/diagnostics
src/test/ui-fulldeps/session-diagnostic Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,8 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> {
281281 if should_generate_set_arg ( & field) {
282282 let diag = & self . parent . diag ;
283283 let ident = field. ident . as_ref ( ) . unwrap ( ) ;
284+ // strip `r#` prefix, if present
285+ let ident = format_ident ! ( "{}" , ident) ;
284286 return quote ! {
285287 #diag. set_arg(
286288 stringify!( #ident) ,
Original file line number Diff line number Diff line change @@ -189,6 +189,9 @@ impl<'a> SubdiagnosticDeriveBuilder<'a> {
189189
190190 let diag = & self . diag ;
191191 let ident = ast. ident . as_ref ( ) . unwrap ( ) ;
192+ // strip `r#` prefix, if present
193+ let ident = format_ident ! ( "{}" , ident) ;
194+
192195 quote ! {
193196 #diag. set_arg(
194197 stringify!( #ident) ,
Original file line number Diff line number Diff line change @@ -671,3 +671,9 @@ enum ExampleEnum {
671671 #[ diag( typeck:: ambiguous_lifetime_bound) ]
672672 Baz ,
673673}
674+
675+ #[ derive( Diagnostic ) ]
676+ #[ diag( typeck:: ambiguous_lifetime_bound, code = "E0123" ) ]
677+ struct RawIdentDiagnosticArg {
678+ pub r#type : String ,
679+ }
Original file line number Diff line number Diff line change @@ -633,3 +633,11 @@ struct BI {
633633 #[ suggestion_part( code = "" ) ]
634634 spans : Vec < Span > ,
635635}
636+
637+ #[ derive( Subdiagnostic ) ]
638+ #[ label( parser:: add_paren) ]
639+ struct BJ {
640+ #[ primary_span]
641+ span : Span ,
642+ r#type : String ,
643+ }
You can’t perform that action at this time.
0 commit comments