File tree 2 files changed +9
-2
lines changed
test/compile-fail-fulldeps/proc-macro
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 {
96
96
}
97
97
} ;
98
98
99
+ let error_count_before = ecx. parse_sess . span_diagnostic . err_count ( ) ;
99
100
__internal:: set_sess ( ecx, || {
101
+ let msg = "proc-macro derive produced unparseable tokens" ;
100
102
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
+ }
101
108
Ok ( new_items) => new_items. into_iter ( ) . map ( Annotatable :: Item ) . collect ( ) ,
102
109
Err ( _) => {
103
110
// FIXME: handle this better
104
- let msg = "proc-macro derive produced unparseable tokens" ;
105
111
ecx. struct_span_fatal ( span, msg) . emit ( ) ;
106
112
panic ! ( FatalError ) ;
107
113
}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ extern crate derive_bad;
17
17
#[ derive(
18
18
A
19
19
) ]
20
- //~^^ ERROR: proc-macro derive produced unparseable tokens
20
+ //~^^ ERROR proc-macro derive produced unparseable tokens
21
+ //~| ERROR expected `:`, found `}`
21
22
struct A ;
22
23
23
24
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments