diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-03-20 22:19:52 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-11-30 06:15:20 +0200 |
| commit | fcca22cb4072097fc2cd1ae78ff84c7d59aacda2 (patch) | |
| tree | ff9a90706e343251ea3b7e3f86e46f3401d089f1 /src/test/run-make | |
| parent | d3ab4a74efad266155fcd402c8d159af9e443e3d (diff) | |
| download | rust-fcca22cb4072097fc2cd1ae78ff84c7d59aacda2.tar.gz rust-fcca22cb4072097fc2cd1ae78ff84c7d59aacda2.zip | |
tests: move all proc_macro tests from -fulldeps.
Diffstat (limited to 'src/test/run-make')
| -rw-r--r-- | src/test/run-make/rustc-macro-dep-files/Makefile | 6 | ||||
| -rw-r--r-- | src/test/run-make/rustc-macro-dep-files/bar.rs | 19 | ||||
| -rw-r--r-- | src/test/run-make/rustc-macro-dep-files/foo.rs | 22 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile new file mode 100644 index 00000000000..68405851f9d --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/Makefile @@ -0,0 +1,6 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) foo.rs + $(RUSTC) bar.rs --emit dep-info + $(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d diff --git a/src/test/run-make/rustc-macro-dep-files/bar.rs b/src/test/run-make/rustc-macro-dep-files/bar.rs new file mode 100644 index 00000000000..03330c3d170 --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/bar.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_use] +extern crate foo; + +#[derive(A)] +struct A; + +fn main() { + let _b = B; +} diff --git a/src/test/run-make/rustc-macro-dep-files/foo.rs b/src/test/run-make/rustc-macro-dep-files/foo.rs new file mode 100644 index 00000000000..2f2524f6ef1 --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/foo.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("struct A;")); + "struct B;".parse().unwrap() +} |
