aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2025-03-07 13:26:59 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-31 21:07:16 +0200
commitbca80539a2b340ac67090d615b8901ca75818390 (patch)
treeb14016a8b0a9616c15990de8a081c0b420785532 /gcc
parent284120406a9f916a538af36b34127a0bfa33bb06 (diff)
downloadgcc-bca80539a2b340ac67090d615b8901ca75818390.zip
gcc-bca80539a2b340ac67090d615b8901ca75818390.tar.gz
gcc-bca80539a2b340ac67090d615b8901ca75818390.tar.bz2
gccrs: testsuite: Add more testcases for cfg() in core
gcc/testsuite/ChangeLog: * rust/compile/cfg-core1.rs: New test. * rust/compile/cfg-core2.rs: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/cfg-core1.rs12
-rw-r--r--gcc/testsuite/rust/compile/cfg-core2.rs12
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/cfg-core1.rs b/gcc/testsuite/rust/compile/cfg-core1.rs
new file mode 100644
index 0000000..7780cc9
--- /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 0000000..e346edd
--- /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;
+}