File tree 3 files changed +11
-1
lines changed
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
133
133
expand_proc_macro_panicked =
134
134
proc macro panicked
135
135
.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 {
390
390
pub ( crate ) struct ProcMacroPanickedHelp {
391
391
pub message : String ,
392
392
}
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 {
176
176
177
177
// fail if there have been errors emitted
178
178
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 } ) ;
180
180
}
181
181
182
182
ExpandResult :: Ready ( items)
You can’t perform that action at this time.
0 commit comments