diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2018-01-16 19:31:15 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2018-01-16 19:31:15 +0100 |
| commit | f0a7d8e2bd5a878ef65b34406637c1032507a675 (patch) | |
| tree | 4ce1a76dd3e494b114623851b46ea0f91ded41a5 | |
| parent | 8756ef6385ef8a1c77d46f44b54e4580cfcadc6d (diff) | |
| download | rust-f0a7d8e2bd5a878ef65b34406637c1032507a675.tar.gz rust-f0a7d8e2bd5a878ef65b34406637c1032507a675.zip | |
Add incremental-fulldeps test suite and regression test for #47290.
| -rw-r--r-- | src/bootstrap/check.rs | 5 | ||||
| -rw-r--r-- | src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs | 31 | ||||
| -rw-r--r-- | src/test/incremental-fulldeps/incremental_proc_macro.rs | 27 |
3 files changed, 63 insertions, 0 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index ed110762cb3..ecaf4d0c08c 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -568,6 +568,11 @@ static HOST_COMPILETESTS: &[Test] = &[ mode: "compile-fail", suite: "compile-fail-fulldeps", }, + Test { + path: "src/test/incremental-fulldeps", + mode: "incremental", + suite: "incremental-fulldeps", + }, Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" }, Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" }, diff --git a/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs b/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs new file mode 100644 index 00000000000..e9f9ba86f23 --- /dev/null +++ b/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs @@ -0,0 +1,31 @@ +// Copyright 2018 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. + +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +// Add a function to shift DefIndex of registrar function +#[cfg(cfail2)] +fn foo() {} + +#[proc_macro_derive(IncrementalMacro)] +pub fn derive(input: TokenStream) -> TokenStream { + #[cfg(cfail2)] + { + foo(); + } + + "".parse().unwrap() +} diff --git a/src/test/incremental-fulldeps/incremental_proc_macro.rs b/src/test/incremental-fulldeps/incremental_proc_macro.rs new file mode 100644 index 00000000000..e4345070853 --- /dev/null +++ b/src/test/incremental-fulldeps/incremental_proc_macro.rs @@ -0,0 +1,27 @@ +// Copyright 2018 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. + +// aux-build:incremental_proc_macro_aux.rs +// ignore-stage1 +// revisions: cfail1 cfail2 +// must-compile-successfully + +// This test makes sure that we still find the proc-macro registrar function +// when we compile proc-macros incrementally (see #47292). + +#![crate_type = "rlib"] + +#[macro_use] +extern crate incremental_proc_macro_aux; + +#[derive(IncrementalMacro)] +pub struct Foo { + x: u32 +} |
