Support generic type

This commit is contained in:
sinkuu 2017-02-17 19:59:52 +09:00
parent 16e53c9868
commit 8cb2ec804d
9 changed files with 43 additions and 17 deletions

View file

@ -13,4 +13,11 @@ fn main() {
assert!(1 == 2);
assert!(Debug(1) == Debug(2));
assert!(NonDebug(1) == NonDebug(1)); // ok
test_generic(1, 2, 3, 4);
}
fn test_generic<T: std::fmt::Debug + Eq, U: Eq>(x: T, y: T, z: U, w: U) {
assert!(x == y);
assert!(z == w); // ok
}

View file

@ -19,5 +19,13 @@ error: use `assert_eq` for better reporting
|
= note: this error originates in a macro outside of the current crate
error: aborting due to 2 previous errors
error: use `assert_eq` for better reporting
--> $DIR/should_assert_eq.rs:21:5
|
21 | assert!(x == y);
| ^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate
error: aborting due to 3 previous errors