Add new tests, fix up old tests

This commit is contained in:
Michael Goulet 2022-01-07 10:26:17 -08:00
parent 9bf9fe07dc
commit 7bf0cb7671
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// check-pass
struct Test<T>([T; 1]);
impl<T> std::ops::Deref for Test<T> {
type Target = [T; 1];
fn deref(&self) -> &[T; 1] {
&self.0
}
}
fn main() {
let out = Test([(); 1]);
let blah = out.len();
println!("{}", blah);
}

View File

@ -0,0 +1,27 @@
// check-pass
struct Test<T, const N: usize>([T; N]);
impl<T: Copy + Default, const N: usize> Default for Test<T, N> {
fn default() -> Self {
Self([T::default(); N])
}
}
impl<T, const N: usize> std::ops::Deref for Test<T, N> {
type Target = [T; N];
fn deref(&self) -> &[T; N] {
&self.0
}
}
fn test() -> Test<u64, 16> {
let test = Test::default();
println!("{}", test.len());
test
}
fn main() {
test();
}