File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
test/run-pass-fulldeps/proc-macro Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ pub fn modify(sess: &ParseSess,
7575 handler. err ( "cannot mix `proc-macro` crate type with others" ) ;
7676 }
7777
78+ if is_test_crate {
79+ return krate;
80+ }
81+
7882 krate. module . items . push ( mk_registrar ( & mut cx, & collect. derives ) ) ;
7983
8084 if krate. exported_macros . len ( ) > 0 {
@@ -141,8 +145,6 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
141145 }
142146
143147 if self . is_test_crate {
144- self . handler . span_err ( attr. span ( ) ,
145- "`--test` cannot be used with proc-macro crates" ) ;
146148 return ;
147149 }
148150
Original file line number Diff line number Diff line change 88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11+ // no-prefer-dynamic
1112// compile-flags: --test
1213
1314#![ crate_type = "proc-macro" ]
15+ #![ feature( proc_macro) ]
1416#![ feature( proc_macro, proc_macro_lib) ]
1517
1618extern crate proc_macro;
1719
18- #[ proc_macro_derive( A ) ]
19- //~^ ERROR: `--test` cannot be used with proc-macro crates
20- pub fn foo1 ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream {
20+ use proc_macro:: TokenStream ;
21+
22+ #[ proc_macro_derive( Foo ) ]
23+ pub fn derive_foo ( _input : TokenStream ) -> TokenStream {
2124 "" . parse ( ) . unwrap ( )
2225}
26+
27+ #[ test]
28+ pub fn test_derive ( ) {
29+ assert ! ( true ) ;
30+ }
You can’t perform that action at this time.
0 commit comments