Skip to content

Commit 42e3f95

Browse files
sshilovskycuviper
authored andcommitted
add test: check_numassignref_ops
1 parent 136080b commit 42e3f95

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,5 +622,15 @@ fn check_numassign_ops() {
622622
assert_eq!(compute(1, 2), 1)
623623
}
624624

625-
// TODO test `NumAssignRef`, but even the standard numeric types don't
626-
// implement this yet. (see rust pr41336)
625+
#[test]
626+
fn check_numassignref_ops() {
627+
fn compute<T: NumAssignRef + Copy>(mut x: T, y: &T) -> T {
628+
x *= y;
629+
x /= y;
630+
x %= y;
631+
x += y;
632+
x -= y;
633+
x
634+
}
635+
assert_eq!(compute(1, &2), 1)
636+
}

0 commit comments

Comments
 (0)