Skip to content

Commit d0cfe83

Browse files
committed
wip(test): Run with -- --nocapture --verbose and invoked should not appear in 2nd output
1 parent 2a0d576 commit d0cfe83

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ force-host
2+
//@ no-prefer-dynamic
3+
4+
#![crate_type = "proc-macro"]
5+
6+
extern crate proc_macro;
7+
use proc_macro::TokenStream;
8+
9+
#[proc_macro_derive(Nothing)]
10+
pub fn derive(input: TokenStream) -> TokenStream {
11+
eprintln!("invoked");
12+
13+
r#"
14+
pub mod nothing_mod {
15+
// #[cfg(cfail1)]
16+
pub fn nothing() {
17+
eprintln!("nothing");
18+
}
19+
20+
// #[cfg(cfail2)]
21+
// fn nothingx() {}
22+
}
23+
"#.parse().unwrap()
24+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//@ aux-build:derive_nothing.rs
2+
//@ revisions:cfail1 cfail2
3+
//@ compile-flags: -Z query-dep-graph
4+
//@ check-pass (FIXME(62277): could be check-pass?)
5+
6+
// TODO(pr-time): do these revisions make sense? only "check" required?
7+
8+
#![feature(rustc_attrs)]
9+
#![feature(stmt_expr_attributes)]
10+
#![allow(dead_code)]
11+
#![crate_type = "rlib"]
12+
13+
#![rustc_partition_codegened(module="item_changed-foo", cfg="cfail1")]
14+
// #![rustc_partition_reused(module="item_changed-foo", cfg="cfail2")]
15+
#![rustc_partition_reused(module="item_changed-foo-nothing_mod", cfg="cfail2")]
16+
17+
#[macro_use]
18+
extern crate derive_nothing;
19+
20+
pub mod foo {
21+
// #[rustc_clean(cfg="cfail2")]
22+
#[derive(Nothing)]
23+
pub struct Foo;
24+
25+
#[cfg(cfail2)]
26+
pub fn second_fn() {
27+
eprintln!("just forcing codegen");
28+
}
29+
30+
pub fn use_foo(_f: Foo) {
31+
// #[cfg(cfail1)]
32+
nothing_mod::nothing();
33+
34+
// #[cfg(cfail2)]
35+
// nothingx();
36+
37+
eprintln!("foo used");
38+
}
39+
}
40+
41+
// fn main() {
42+
// Foo;
43+
//
44+
// nothing();
45+
//
46+
// #[cfg(rpass2)]
47+
// Bar;
48+
// }

0 commit comments

Comments
 (0)