Skip to content

Commit

Permalink
chore: disambiguate trait used in test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jan 25, 2024
1 parent 4d43e24 commit a3eac9b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

fn main() {
let xs: [Field; 1] = [3];
let ys: [u32; 1] = [3];
Expand All @@ -8,21 +7,21 @@ fn main() {
assert_eq(15, sum_static(Data { a: 5, b: 10 }));
}

fn foo<T, U>(x: T, u: U) where T: Into<U>, U: Eq {
fn foo<T, U>(x: T, u: U) where T: MyInto<U>, U: Eq {
assert(x.into() == u);
}

trait Into<T> {
trait MyInto<T> {
fn into(self) -> T;
}

impl<T, U, N> Into<[U; N]> for [T; N] where T: Into<U> {
impl<T, U, N> MyInto<[U; N]> for [T; N] where T: MyInto<U> {
fn into(self) -> [U; N] {
self.map(|x: T| x.into())
}
}

impl Into<u32> for Field {
impl MyInto<u32> for Field {
fn into(self) -> u32 {
self as u32
}
Expand Down

0 comments on commit a3eac9b

Please sign in to comment.