rollup merge of #22116: kmcallister/cfg_attr
Fixes #22070. Fixes #19372. r? @sfackler
This commit is contained in:
commit
bbc8a54c63
10 changed files with 133 additions and 54 deletions
18
src/test/compile-fail/cfg-attr-cfg-2.rs
Normal file
18
src/test/compile-fail/cfg-attr-cfg-2.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2015 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.
|
||||
//
|
||||
// error-pattern: main function not found
|
||||
// compile-flags: --cfg foo
|
||||
|
||||
// main is conditionally compiled, but the conditional compilation
|
||||
// is conditional too!
|
||||
|
||||
#[cfg_attr(foo, cfg(bar))]
|
||||
fn main() { }
|
||||
17
src/test/compile-fail/cfg-attr-crate-2.rs
Normal file
17
src/test/compile-fail/cfg-attr-crate-2.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2015 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.
|
||||
//
|
||||
// compile-flags: --cfg broken
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
|
||||
|
||||
#![cfg_attr(broken, no_std)] //~ ERROR no_std is experimental
|
||||
|
||||
fn main() { }
|
||||
15
src/test/run-pass/cfg-attr-cfg.rs
Normal file
15
src/test/run-pass/cfg-attr-cfg.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
// main is conditionally compiled, but the conditional compilation
|
||||
// is conditional too!
|
||||
|
||||
#[cfg_attr(foo, cfg(bar))]
|
||||
fn main() { }
|
||||
15
src/test/run-pass/cfg-attr-crate.rs
Normal file
15
src/test/run-pass/cfg-attr-crate.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
|
||||
|
||||
#![cfg_attr(not_used, no_std)]
|
||||
|
||||
fn main() { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue