Skip to content

Commit 7bf0cb7

Browse files
Add new tests, fix up old tests
1 parent 9bf9fe0 commit 7bf0cb7

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// check-pass
2+
3+
struct Test<T>([T; 1]);
4+
5+
impl<T> std::ops::Deref for Test<T> {
6+
type Target = [T; 1];
7+
8+
fn deref(&self) -> &[T; 1] {
9+
&self.0
10+
}
11+
}
12+
13+
fn main() {
14+
let out = Test([(); 1]);
15+
let blah = out.len();
16+
println!("{}", blah);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// check-pass
2+
3+
struct Test<T, const N: usize>([T; N]);
4+
5+
impl<T: Copy + Default, const N: usize> Default for Test<T, N> {
6+
fn default() -> Self {
7+
Self([T::default(); N])
8+
}
9+
}
10+
11+
impl<T, const N: usize> std::ops::Deref for Test<T, N> {
12+
type Target = [T; N];
13+
14+
fn deref(&self) -> &[T; N] {
15+
&self.0
16+
}
17+
}
18+
19+
fn test() -> Test<u64, 16> {
20+
let test = Test::default();
21+
println!("{}", test.len());
22+
test
23+
}
24+
25+
fn main() {
26+
test();
27+
}

0 commit comments

Comments
 (0)