diff options
| author | bors <bors@rust-lang.org> | 2016-12-05 14:27:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-05 14:27:06 +0000 |
| commit | d346dbc938da2f8d1bd13492331d9ec1b15bdac7 (patch) | |
| tree | 8e13c43191f77149962d437e6af7bf9d8f45639c /src/libsyntax_ext | |
| parent | 692d7cfb0ce5ba43311ae553a3debcf09755b6b9 (diff) | |
| parent | bfdd2d4177391312022b48a328ff4f177769055c (diff) | |
| download | rust-d346dbc938da2f8d1bd13492331d9ec1b15bdac7.tar.gz rust-d346dbc938da2f8d1bd13492331d9ec1b15bdac7.zip | |
Auto merge of #38107 - keeperofdakeys:proc-macro-test, r=alexcrichton
Allow --test to be used on proc-macro crates Fixes #37480 This patch allows `--test` to work for proc-macro crates, removing the previous error.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/proc_macro_registrar.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs index bbdbda701ae..6256440bc81 100644 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ b/src/libsyntax_ext/proc_macro_registrar.rs @@ -75,6 +75,10 @@ pub fn modify(sess: &ParseSess, handler.err("cannot mix `proc-macro` crate type with others"); } + if is_test_crate { + return krate; + } + krate.module.items.push(mk_registrar(&mut cx, &collect.derives)); if krate.exported_macros.len() > 0 { @@ -141,8 +145,6 @@ impl<'a> Visitor for CollectCustomDerives<'a> { } if self.is_test_crate { - self.handler.span_err(attr.span(), - "`--test` cannot be used with proc-macro crates"); return; } |
