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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
337 B
Rust
Raw Normal View History

//@ check-pass
use std::marker::PhantomData;
struct Foo<T>(PhantomData<T>);
impl Clone for Foo<u8> {
fn clone(&self) -> Self {
Foo(PhantomData)
}
}
impl Copy for Foo<u8> {}
fn extract<T, const N: usize>(_: [Foo<T>; N]) -> T {
loop {}
}
fn main() {
let x = [Foo(PhantomData); 2];
_ = extract(x).max(2);
}