Skip to content

Commit

Permalink
Test that unconfigured macro-expanded macro definitions are not invok…
Browse files Browse the repository at this point in the history
…able,

test that unconfigured macro-expanded macro invocations are not expanded, and
test that feature gated cfg variables on macro-expanded macro definitions are errors.
  • Loading branch information
jseyfried committed May 19, 2016
1 parent ddc1d7f commit b6e3247
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/test/compile-fail/expanded-cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(custom_attribute, rustc_attrs)]
#![feature(custom_attribute)]

macro_rules! mac {
{} => {
Expand All @@ -19,11 +19,18 @@ macro_rules! mac {

#[cfg_attr(target_thread_local, custom)]
fn g() {}

unconfigured_invocation!();
}

#[cfg(target_thread_local)] //~ ERROR experimental and subject to change
macro_rules! foo { () => {} }

#[cfg(attr)]
macro_rules! foo { () => { compile error } }

foo!();
}
}

mac! {}

#[rustc_error]
fn main() {} //~ ERROR compilation successful

0 comments on commit b6e3247

Please sign in to comment.