File tree 2 files changed +15
-5
lines changed
test/run-pass-fulldeps/proc-macro
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,
75
75
handler. err ( "cannot mix `proc-macro` crate type with others" ) ;
76
76
}
77
77
78
+ if is_test_crate {
79
+ return krate;
80
+ }
81
+
78
82
krate. module . items . push ( mk_registrar ( & mut cx, & collect. derives ) ) ;
79
83
80
84
if krate. exported_macros . len ( ) > 0 {
@@ -141,8 +145,6 @@ impl<'a> Visitor for CollectCustomDerives<'a> {
141
145
}
142
146
143
147
if self . is_test_crate {
144
- self . handler . span_err ( attr. span ( ) ,
145
- "`--test` cannot be used with proc-macro crates" ) ;
146
148
return ;
147
149
}
148
150
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ // no-prefer-dynamic
11
12
// compile-flags: --test
12
13
13
14
#![ crate_type = "proc-macro" ]
15
+ #![ feature( proc_macro) ]
14
16
#![ feature( proc_macro, proc_macro_lib) ]
15
17
16
18
extern crate proc_macro;
17
19
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 {
21
24
"" . parse ( ) . unwrap ( )
22
25
}
26
+
27
+ #[ test]
28
+ pub fn test_derive ( ) {
29
+ assert ! ( true ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments