File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
test/compile-fail-fulldeps/proc-macro Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,18 @@ impl MultiItemModifier for ProcMacroDerive {
9696 }
9797 } ;
9898
99+ let error_count_before = ecx. parse_sess . span_diagnostic . err_count ( ) ;
99100 __internal:: set_sess ( ecx, || {
101+ let msg = "proc-macro derive produced unparseable tokens" ;
100102 match __internal:: token_stream_parse_items ( stream) {
103+ // fail if there have been errors emitted
104+ Ok ( _) if ecx. parse_sess . span_diagnostic . err_count ( ) > error_count_before => {
105+ ecx. struct_span_fatal ( span, msg) . emit ( ) ;
106+ panic ! ( FatalError ) ;
107+ }
101108 Ok ( new_items) => new_items. into_iter ( ) . map ( Annotatable :: Item ) . collect ( ) ,
102109 Err ( _) => {
103110 // FIXME: handle this better
104- let msg = "proc-macro derive produced unparseable tokens" ;
105111 ecx. struct_span_fatal ( span, msg) . emit ( ) ;
106112 panic ! ( FatalError ) ;
107113 }
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ extern crate derive_bad;
1717#[ derive(
1818 A
1919) ]
20- //~^^ ERROR: proc-macro derive produced unparseable tokens
20+ //~^^ ERROR proc-macro derive produced unparseable tokens
21+ //~| ERROR expected `:`, found `}`
2122struct A ;
2223
2324fn main ( ) { }
You can’t perform that action at this time.
0 commit comments