Skip to content

Commit 5a7b377

Browse files
authored
Rollup merge of #70539 - DutchGhost:test-62220, r=Dylan-DPC
add test for 62220 Closes #62220 Adds a test for #62220. Im not sure whether `check-pass` is sufficient here. I didn't put `run-pass` in, as I'm afraid that'll fail due to the `unimplemented!()` return in the code.
2 parents d009ce4 + 61d4193 commit 5a7b377

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// build-pass
2+
#![allow(incomplete_features)]
3+
4+
#![feature(const_generics)]
5+
pub struct Vector<T, const N: usize>([T; N]);
6+
7+
pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;
8+
9+
impl<T, const N: usize> Vector<T, { N }> {
10+
/// Drop the last component and return the vector with one fewer dimension.
11+
pub fn trunc(self) -> (TruncatedVector<T, { N }>, T) {
12+
unimplemented!()
13+
}
14+
}
15+
16+
fn vec4<T>(a: T, b: T, c: T, d: T) -> Vector<T, 4> {
17+
Vector([a, b, c, d])
18+
}
19+
20+
fn main() {
21+
let (_xyz, _w): (TruncatedVector<u32, 4>, u32) = vec4(0u32, 1, 2, 3).trunc();
22+
}

0 commit comments

Comments
 (0)