summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs
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/rfc-2497-if-let-chains/ast-validate-guards.rs
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/rfc-2497-if-let-chains/ast-validate-guards.rs')
-rw-r--r--tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs b/tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs
new file mode 100644
index 000000000..e6dee2a1d
--- /dev/null
+++ b/tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs
@@ -0,0 +1,23 @@
+#![feature(let_chains)]
+
+fn let_or_guard(x: Result<Option<i32>, ()>) {
+ match x {
+ Ok(opt) if let Some(4) = opt || false => {}
+ //~^ ERROR `let` expressions are not supported here
+ _ => {}
+ }
+}
+
+fn hiding_unsafe_mod(x: Result<Option<i32>, ()>) {
+ match x {
+ Ok(opt)
+ if {
+ unsafe mod a {};
+ //~^ ERROR module cannot be declared unsafe
+ false
+ } => {}
+ _ => {}
+ }
+}
+
+fn main() {}