Skip to content

Commit

Permalink
Add incremental-fulldeps test suite and regression test for rust-lang…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Jan 16, 2018
1 parent 8756ef6 commit f0a7d8e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" },

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
}
27 changes: 27 additions & 0 deletions src/test/incremental-fulldeps/incremental_proc_macro.rs
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit f0a7d8e

Please sign in to comment.