]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/proc-macro/issue-75930-derive-cfg.rs
2 // compile-flags: -Z span-debug --error-format human
3 // aux-build:test-macros.rs
5 // Regression test for issue #75930
6 // Tests that we cfg-strip all targets before invoking
8 // We need '--error-format human' to stop compiletest from
9 // trying to interpret proc-macro output as JSON messages
10 // (a pretty-printed struct may cause a line to start with '{' )
11 // FIXME: We currently lose spans here (see issue #43081)
13 #![no_std] // Don't load unnecessary hygiene information from std
17 extern crate test_macros
;
19 #[print_helper(a)] //~ WARN derive helper attribute is used before it is introduced
20 //~| WARN this was previously accepted
21 #[cfg_attr(not(FALSE), allow(dead_code))]
25 struct Foo
<#[cfg(FALSE)] A, B> {
26 #[cfg(FALSE)] first: String,
27 #[cfg_attr(FALSE, deny(warnings))] second: bool,
29 #[cfg(FALSE)] struct Bar;
30 #[cfg(not(FALSE))] struct Inner;
31 #[cfg(FALSE)] let a = 25;
33 #[cfg(FALSE)] true => {},
34 #[cfg_attr(not(FALSE), allow(warnings))] false => {},
38 #[print_helper(should_be_removed)]
43 #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn() {
52 #[cfg(not(FALSE))] i32,
53 #[cfg(FALSE)] String, u8
59 #[cfg(not(FALSE))] i32,
64 fn plain_removed_fn() {
65 #![cfg_attr(not(FALSE), cfg(FALSE))]