summaryrefslogtreecommitdiffstats
path: root/tests/ui/cfg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui/cfg
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/cfg')
-rw-r--r--tests/ui/cfg/cfg-stmt-recovery.rs13
-rw-r--r--tests/ui/cfg/cfg-stmt-recovery.stderr20
-rw-r--r--tests/ui/cfg/conditional-compile-arch.rs3
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/cfg/cfg-stmt-recovery.rs b/tests/ui/cfg/cfg-stmt-recovery.rs
new file mode 100644
index 000000000..2e0839d2a
--- /dev/null
+++ b/tests/ui/cfg/cfg-stmt-recovery.rs
@@ -0,0 +1,13 @@
+// Verify that we do not ICE when failing to parse a statement in `cfg_eval`.
+
+#![feature(cfg_eval)]
+#![feature(stmt_expr_attributes)]
+
+#[cfg_eval]
+fn main() {
+ #[cfg_eval]
+ let _ = #[cfg(FALSE)] 0;
+ //~^ ERROR removing an expression is not supported in this position
+ //~| ERROR expected expression, found `;`
+ //~| ERROR removing an expression is not supported in this position
+}
diff --git a/tests/ui/cfg/cfg-stmt-recovery.stderr b/tests/ui/cfg/cfg-stmt-recovery.stderr
new file mode 100644
index 000000000..cb15e21fa
--- /dev/null
+++ b/tests/ui/cfg/cfg-stmt-recovery.stderr
@@ -0,0 +1,20 @@
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-stmt-recovery.rs:9:13
+ |
+LL | let _ = #[cfg(FALSE)] 0;
+ | ^^^^^^^^^^^^^
+
+error: expected expression, found `;`
+ --> $DIR/cfg-stmt-recovery.rs:9:28
+ |
+LL | let _ = #[cfg(FALSE)] 0;
+ | ^ expected expression
+
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-stmt-recovery.rs:9:13
+ |
+LL | let _ = #[cfg(FALSE)] 0;
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/cfg/conditional-compile-arch.rs b/tests/ui/cfg/conditional-compile-arch.rs
index 7de561df1..e59e06f80 100644
--- a/tests/ui/cfg/conditional-compile-arch.rs
+++ b/tests/ui/cfg/conditional-compile-arch.rs
@@ -39,3 +39,6 @@ pub fn main() { }
#[cfg(target_arch = "riscv64")]
pub fn main() { }
+
+#[cfg(target_arch = "loongarch64")]
+pub fn main() { }