From: Arthur Cohen <arthur.co...@embecosm.com>

gcc/testsuite/ChangeLog:

        * rust/compile/cfg-core1.rs: New test.
        * rust/compile/cfg-core2.rs: New test.
---
 gcc/testsuite/rust/compile/cfg-core1.rs | 12 ++++++++++++
 gcc/testsuite/rust/compile/cfg-core2.rs | 12 ++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/cfg-core1.rs
 create mode 100644 gcc/testsuite/rust/compile/cfg-core2.rs

diff --git a/gcc/testsuite/rust/compile/cfg-core1.rs 
b/gcc/testsuite/rust/compile/cfg-core1.rs
new file mode 100644
index 00000000000..7780cc9587a
--- /dev/null
+++ b/gcc/testsuite/rust/compile/cfg-core1.rs
@@ -0,0 +1,12 @@
+// { dg-additional-options "-frust-cfg=A -frust-cfg=B" }
+
+#[cfg_attr(A, cfg(B))]
+struct Foo0;
+
+#[cfg_attr(A, cfg(C))]
+struct Bar0;
+
+fn main() {
+    let a = Foo0;
+    let a = Bar0; // { dg-error "cannot find value" }
+}
diff --git a/gcc/testsuite/rust/compile/cfg-core2.rs 
b/gcc/testsuite/rust/compile/cfg-core2.rs
new file mode 100644
index 00000000000..e346eddd1a6
--- /dev/null
+++ b/gcc/testsuite/rust/compile/cfg-core2.rs
@@ -0,0 +1,12 @@
+// { dg-additional-options "-frust-cfg=B" }
+
+#[cfg(not(any(A, B)))]
+struct Foo0;
+
+#[cfg(not(any(A, C)))]
+struct Bar0;
+
+fn main() {
+    let a = Foo0; // { dg-error "cannot find value" }
+    let a = Bar0;
+}
-- 
2.49.0

Reply via email to