summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/infer/issue-77092.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/infer/issue-77092.rs')
-rw-r--r--src/test/ui/const-generics/infer/issue-77092.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/infer/issue-77092.rs b/src/test/ui/const-generics/infer/issue-77092.rs
new file mode 100644
index 000000000..fcf7d3282
--- /dev/null
+++ b/src/test/ui/const-generics/infer/issue-77092.rs
@@ -0,0 +1,14 @@
+use std::convert::TryInto;
+
+fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] {
+ (&mut data[start .. start + N]).try_into().unwrap()
+}
+
+fn main() {
+ let mut arr = [0, 1, 2, 3, 4, 5, 6, 7, 8];
+
+ for i in 1 .. 4 {
+ println!("{:?}", take_array_from_mut(&mut arr, i));
+ //~^ ERROR type annotations needed
+ }
+}