Skip to content

Commit

Permalink
add a build-pass test for issue 62220
Browse files Browse the repository at this point in the history
  • Loading branch information
DutchGhost committed Mar 29, 2020
1 parent 8ab82b8 commit 61d4193
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/ui/const-generics/issues/issue-62220.rs
@@ -0,0 +1,22 @@
// build-pass
#![allow(incomplete_features)]

#![feature(const_generics)]
pub struct Vector<T, const N: usize>([T; N]);

pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;

impl<T, const N: usize> Vector<T, { N }> {
/// Drop the last component and return the vector with one fewer dimension.
pub fn trunc(self) -> (TruncatedVector<T, { N }>, T) {
unimplemented!()
}
}

fn vec4<T>(a: T, b: T, c: T, d: T) -> Vector<T, 4> {
Vector([a, b, c, d])
}

fn main() {
let (_xyz, _w): (TruncatedVector<u32, 4>, u32) = vec4(0u32, 1, 2, 3).trunc();
}

0 comments on commit 61d4193

Please sign in to comment.