From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/iterators/collect-into-slice.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/ui/iterators/collect-into-slice.rs (limited to 'tests/ui/iterators/collect-into-slice.rs') diff --git a/tests/ui/iterators/collect-into-slice.rs b/tests/ui/iterators/collect-into-slice.rs new file mode 100644 index 000000000..5a8aacb1a --- /dev/null +++ b/tests/ui/iterators/collect-into-slice.rs @@ -0,0 +1,17 @@ +fn process_slice(data: &[i32]) { + todo!() +} + +fn main() { + let some_generated_vec = (0..10).collect(); + //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time + //~| ERROR the size for values of type `[i32]` cannot be known at compilation time + //~| ERROR a slice of type `[i32]` cannot be built since `[i32]` has no definite size + //~| NOTE try explicitly collecting into a `Vec<{integer}>` + //~| NOTE required by a bound in `collect` + //~| NOTE required by a bound in `collect` + //~| NOTE all local variables must have a statically known size + //~| NOTE doesn't have a size known at compile-time + //~| NOTE doesn't have a size known at compile-time + process_slice(&some_generated_vec); +} -- cgit v1.2.3