Distinction for commutative scalar ops

This commit is contained in:
Sam Cappleman-Lynes 2017-06-29 09:59:42 +01:00
parent fd2f516a5d
commit 5738141b7c
2 changed files with 11 additions and 11 deletions

View File

@ -394,7 +394,7 @@ impl<'a> Add<&'a BigUint> for BigUint {
} }
} }
forward_all_scalar_binop_to_val_val!(impl Add<BigDigit> for BigUint, add); forward_all_scalar_binop_to_val_val_commutative!(impl Add<BigDigit> for BigUint, add);
impl Add<BigDigit> for BigUint { impl Add<BigDigit> for BigUint {
type Output = BigUint; type Output = BigUint;
@ -460,7 +460,7 @@ impl<'a, 'b> Mul<&'b BigUint> for &'a BigUint {
} }
} }
forward_all_scalar_binop_to_val_val!(impl Mul<BigDigit> for BigUint, mul); forward_all_scalar_binop_to_val_val_commutative!(impl Mul<BigDigit> for BigUint, mul);
impl Mul<BigDigit> for BigUint { impl Mul<BigDigit> for BigUint {
type Output = BigUint; type Output = BigUint;

View File

@ -105,7 +105,7 @@ macro_rules! forward_ref_ref_binop_commutative {
} }
} }
macro_rules! forward_scalar_val_val_binop { macro_rules! forward_scalar_val_val_binop_commutative {
(impl $imp:ident<$scalar:ty> for $res:ty, $method: ident) => { (impl $imp:ident<$scalar:ty> for $res:ty, $method: ident) => {
impl $imp<$res> for $scalar { impl $imp<$res> for $scalar {
type Output = $res; type Output = $res;
@ -118,7 +118,7 @@ macro_rules! forward_scalar_val_val_binop {
} }
} }
macro_rules! forward_scalar_val_ref_binop { macro_rules! forward_scalar_val_ref_binop_commutative {
(impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => { (impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => {
impl<'a> $imp<&'a $scalar> for $res { impl<'a> $imp<&'a $scalar> for $res {
type Output = $res; type Output = $res;
@ -140,7 +140,7 @@ macro_rules! forward_scalar_val_ref_binop {
} }
} }
macro_rules! forward_scalar_ref_val_binop { macro_rules! forward_scalar_ref_val_binop_commutative {
(impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => { (impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => {
impl<'a> $imp<$scalar> for &'a $res { impl<'a> $imp<$scalar> for &'a $res {
type Output = $res; type Output = $res;
@ -162,7 +162,7 @@ macro_rules! forward_scalar_ref_val_binop {
} }
} }
macro_rules! forward_scalar_ref_ref_binop { macro_rules! forward_scalar_ref_ref_binop_commutative {
(impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => { (impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => {
impl<'a, 'b> $imp<&'b $scalar> for &'a $res { impl<'a, 'b> $imp<&'b $scalar> for &'a $res {
type Output = $res; type Output = $res;
@ -211,11 +211,11 @@ macro_rules! forward_all_binop_to_val_ref_commutative {
}; };
} }
macro_rules! forward_all_scalar_binop_to_val_val { macro_rules! forward_all_scalar_binop_to_val_val_commutative {
(impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => { (impl $imp:ident<$scalar:ty> for $res:ty, $method:ident) => {
forward_scalar_val_val_binop!(impl $imp<$scalar> for $res, $method); forward_scalar_val_val_binop_commutative!(impl $imp<$scalar> for $res, $method);
forward_scalar_val_ref_binop!(impl $imp<$scalar> for $res, $method); forward_scalar_val_ref_binop_commutative!(impl $imp<$scalar> for $res, $method);
forward_scalar_ref_val_binop!(impl $imp<$scalar> for $res, $method); forward_scalar_ref_val_binop_commutative!(impl $imp<$scalar> for $res, $method);
forward_scalar_ref_ref_binop!(impl $imp<$scalar> for $res, $method); forward_scalar_ref_ref_binop_commutative!(impl $imp<$scalar> for $res, $method);
} }
} }