Support generic type
This commit is contained in:
parent
16e53c9868
commit
8cb2ec804d
9 changed files with 43 additions and 17 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue