Skip to content

Commit cdd8895

Browse files
committed
Add inference constraining Copy impl test
1 parent 96cfc75 commit cdd8895

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/ui/repeat-expr/infer-eager.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ check-pass
2+
3+
use std::marker::PhantomData;
4+
5+
struct Foo<T>(PhantomData<T>);
6+
7+
impl Clone for Foo<u8> {
8+
fn clone(&self) -> Self {
9+
Foo(PhantomData)
10+
}
11+
}
12+
impl Copy for Foo<u8> {}
13+
14+
fn extract<T, const N: usize>(_: [Foo<T>; N]) -> T {
15+
loop {}
16+
}
17+
18+
fn main() {
19+
let x = [Foo(PhantomData); 2];
20+
_ = extract(x).max(2);
21+
}

0 commit comments

Comments
 (0)