summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-15 00:06:56 +0000
committerbors <bors@rust-lang.org>2015-05-15 00:06:56 +0000
commit2792855fe60eb086b02522ead11affdf646379e3 (patch)
tree52c6a28b74baef7d826a7a228691a50d68a16cd5 /src/test
parent571f371b3fce3e023fb1b41a1682de260c943222 (diff)
parent90b952954bf7e765924f70a8892334b6bb7de93b (diff)
downloadrust-2792855fe60eb086b02522ead11affdf646379e3.tar.gz
rust-2792855fe60eb086b02522ead11affdf646379e3.zip
Auto merge of #25399 - kballard:crate-attributes-cfg_attr, r=alexcrichton
Stripping unconfigured items prior to collecting crate metadata means we
can say things like `#![cfg_attr(foo, crate_type="lib")]`.

Fixes #25347.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/crate-attributes-using-cfg_attr.rs16
-rw-r--r--src/test/run-pass/crate-attributes-using-cfg_attr.rs15
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/auxiliary/crate-attributes-using-cfg_attr.rs b/src/test/auxiliary/crate-attributes-using-cfg_attr.rs
new file mode 100644
index 00000000000..0028b51f9d1
--- /dev/null
+++ b/src/test/auxiliary/crate-attributes-using-cfg_attr.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// no-prefer-dynamic
+// compile-flags: --cfg foo
+
+#![cfg_attr(foo, crate_type="lib")]
+
+pub fn foo() {}
diff --git a/src/test/run-pass/crate-attributes-using-cfg_attr.rs b/src/test/run-pass/crate-attributes-using-cfg_attr.rs
new file mode 100644
index 00000000000..72ccc6723f9
--- /dev/null
+++ b/src/test/run-pass/crate-attributes-using-cfg_attr.rs
@@ -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.
+
+// aux-build:crate-attributes-using-cfg_attr.rs
+
+extern crate crate_attributes_using_cfg_attr;
+
+pub fn main() {}