summaryrefslogtreecommitdiffstats
path: root/tests/ui/cfg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/ui/cfg
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.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() { }