File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -133,3 +133,6 @@ expand_trace_macro = trace_macro
133133expand_proc_macro_panicked =
134134 proc macro panicked
135135 .help = message: { $message }
136+
137+ expand_proc_macro_derive_tokens =
138+ proc-macro derive produced unparseable tokens
Original file line number Diff line number Diff line change @@ -390,3 +390,10 @@ pub(crate) struct ProcMacroPanicked {
390390pub ( crate ) struct ProcMacroPanickedHelp {
391391 pub message : String ,
392392}
393+
394+ #[ derive( Diagnostic ) ]
395+ #[ diag( expand_proc_macro_derive_tokens) ]
396+ pub struct ProcMacroDeriveTokens {
397+ #[ primary_span]
398+ pub span : Span ,
399+ }
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ impl MultiItemModifier for DeriveProcMacro {
176176
177177 // fail if there have been errors emitted
178178 if ecx. sess . parse_sess . span_diagnostic . err_count ( ) > error_count_before {
179- ecx. struct_span_err ( span , "proc-macro derive produced unparseable tokens" ) . emit ( ) ;
179+ ecx. sess . emit_err ( errors :: ProcMacroDeriveTokens { span } ) ;
180180 }
181181
182182 ExpandResult :: Ready ( items)
You can’t perform that action at this time.
0 commit comments