rust/src/test
Steven Fackler e520bb1b2f Add a cfg_attr syntax extension
This extends cfg-gating to attributes.

```rust
 #[cfg_attr(<cfg pattern>, <attr>)]
```
will expand to
```rust
 #[<attr>]
```
if the `<cfg pattern>` matches the current cfg environment, and nothing
if it does not. The grammar for the cfg pattern has a simple
recursive structure:

 * `value` and `key = "value"` are cfg patterns,
 * `not(<cfg pattern>)` is a cfg pattern and matches if `<cfg pattern>`
    does not.
 * `all(<cfg pattern>, ...)` is a cfg pattern and matches if all of the
    `<cfg pattern>`s do.
 * `any(<cfg pattern>, ...)` is a cfg pattern and matches if any of the
    `<cfg pattern>`s do.

Examples:

```rust
 // only derive Show for assert_eq! in tests
 #[cfg_attr(test, deriving(Show))]
 struct Foo { ... }

 // only derive Show for assert_eq! in tests and debug builds
 #[cfg_attr(any(test, not(ndebug)), deriving(Show))]
 struct Foo { ... }

 // ignore a test in certain cases
 #[test]
 #[cfg_attr(all(not(target_os = "linux"), target_endian = "big"), ignore)]
 fn test_broken_thing() { ... }

 // Avoid duplication when fixing staging issues in rustc
 #[cfg_attr(not(stage0), lang="iter")]
 pub trait Iterator<T> { ... }
```
2014-09-23 23:47:45 -07:00
..
auxiliary librustc: Forbid private types in public APIs. 2014-09-22 20:05:45 -07:00
bench
codegen librustc: Forbid private types in public APIs. 2014-09-22 20:05:45 -07:00
compile-fail auto merge of #17413 : jakub-/rust/issue-17385, r=pcwalton 2014-09-23 17:05:39 +00:00
compile-fail-fulldeps
debuginfo
pretty
run-fail
run-make
run-pass Add a cfg_attr syntax extension 2014-09-23 23:47:45 -07:00
run-pass-fulldeps