about summary refs log tree commit diff
path: root/tests/ui/pattern/refutable-pattern-for-loop-15381.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-10 14:17:41 +0000
committerbors <bors@rust-lang.org>2025-08-10 14:17:41 +0000
commit18eeac04fc5c2a4c4a8020dbdf1c652077ad0e4e (patch)
tree3bb0db94131d71006af1bfd0151bb9d530cf1315 /tests/ui/pattern/refutable-pattern-for-loop-15381.rs
parent7f7b8ef27d86c865a7ab20c7c42f50811c6a914d (diff)
parent934cb10f1b21be3a855951fb9b1f38094946aac8 (diff)
downloadrust-18eeac04fc5c2a4c4a8020dbdf1c652077ad0e4e.tar.gz
rust-18eeac04fc5c2a4c4a8020dbdf1c652077ad0e4e.zip
Auto merge of #145210 - Zalathar:rollup-dm4reb2, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
 - rust-lang/rust#143093 (Simplify polonius location-sensitive analysis)
 - rust-lang/rust#144402 (Stabilize loongarch32 inline asm)
 - rust-lang/rust#144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
 - rust-lang/rust#144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
 - rust-lang/rust#145089 (Improve error output when a command fails in bootstrap)
 - rust-lang/rust#145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
 - rust-lang/rust#145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
 - rust-lang/rust#145130 (improve "Documentation problem" issue template.)
 - rust-lang/rust#145135 (Stabilize `duration_constructors_lite` feature)
 - rust-lang/rust#145145 (some `derive_more` refactors)
 - rust-lang/rust#145147 (rename `TraitRef::from_method` to `from_assoc`)
 - rust-lang/rust#145156 (Override custom Cargo `build-dir` in bootstrap)
 - rust-lang/rust#145160 (Change days-threshold to 28 in [behind-upstream])
 - rust-lang/rust#145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
 - rust-lang/rust#145187 (Fix an unstable feature comment that wasn't a doc comment)
 - rust-lang/rust#145191 (`suggest_borrow_generic_arg`: use the correct generic args)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/pattern/refutable-pattern-for-loop-15381.rs')
-rw-r--r--tests/ui/pattern/refutable-pattern-for-loop-15381.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/pattern/refutable-pattern-for-loop-15381.rs b/tests/ui/pattern/refutable-pattern-for-loop-15381.rs
new file mode 100644
index 00000000000..3c19612c9cc
--- /dev/null
+++ b/tests/ui/pattern/refutable-pattern-for-loop-15381.rs
@@ -0,0 +1,12 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/15381
+
+fn main() {
+    let values: Vec<u8> = vec![1,2,3,4,5,6,7,8];
+
+    for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
+        //~^ ERROR refutable pattern in `for` loop binding
+        //~| NOTE patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered
+        //~| NOTE the matched value is of type `&[u8]`
+        println!("y={}", y);
+    }
+}