about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-02-13 03:53:32 -0500
committerGitHub <noreply@github.com>2025-02-13 03:53:32 -0500
commit6fbca256275eb9ba5d8a804cf5825c501df06cbc (patch)
tree0d6e4b6810387971754548a6dd0e16b9501a909e /tests/ui
parentf7d5285062475fa745654fe6a27de3948c8c5884 (diff)
parent5a76304db63cf7e42908dde599205ddd0cb56f53 (diff)
downloadrust-6fbca256275eb9ba5d8a804cf5825c501df06cbc.tar.gz
rust-6fbca256275eb9ba5d8a804cf5825c501df06cbc.zip
Rollup merge of #136888 - compiler-errors:never-read, r=Nadrieril
Always perform discr read for never pattern in EUV

Always perform a read of `!` discriminants to ensure that it's captured by closures in expr use visitor

Fixes #136852

r? Nadrieril or reassign
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs b/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs
new file mode 100644
index 00000000000..3c4cd57ec24
--- /dev/null
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs
@@ -0,0 +1,16 @@
+//@ check-pass
+
+// Make sure that the closure captures `s` so it can perform a read of `s`.
+
+#![feature(never_patterns)]
+#![allow(incomplete_features)]
+
+enum Void {}
+
+fn by_value(s: Void) {
+    move || {
+        let ! = s;
+    };
+}
+
+fn main() {}