@@ -5,6 +5,22 @@ macro_rules! forward_ref_unop {
5
5
forward_ref_unop!( impl $imp, $method for $t,
6
6
#[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
7
7
} ;
8
+ ( impl const $imp: ident, $method: ident for $t: ty) => {
9
+ forward_ref_unop!( impl const $imp, $method for $t,
10
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
11
+ } ;
12
+ ( impl const $imp: ident, $method: ident for $t: ty, #[ $attr: meta] ) => {
13
+ #[ $attr]
14
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "69420" ) ]
15
+ impl const $imp for & $t {
16
+ type Output = <$t as $imp>:: Output ;
17
+
18
+ #[ inline]
19
+ fn $method( self ) -> <$t as $imp>:: Output {
20
+ $imp:: $method( * self )
21
+ }
22
+ }
23
+ } ;
8
24
( impl $imp: ident, $method: ident for $t: ty, #[ $attr: meta] ) => {
9
25
#[ $attr]
10
26
impl $imp for & $t {
@@ -25,6 +41,44 @@ macro_rules! forward_ref_binop {
25
41
forward_ref_binop!( impl $imp, $method for $t, $u,
26
42
#[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
27
43
} ;
44
+ ( impl const $imp: ident, $method: ident for $t: ty, $u: ty) => {
45
+ forward_ref_binop!( impl const $imp, $method for $t, $u,
46
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
47
+ } ;
48
+ ( impl const $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
49
+ #[ $attr]
50
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "69420" ) ]
51
+ impl <' a> const $imp<$u> for & ' a $t {
52
+ type Output = <$t as $imp<$u>>:: Output ;
53
+
54
+ #[ inline]
55
+ fn $method( self , other: $u) -> <$t as $imp<$u>>:: Output {
56
+ $imp:: $method( * self , other)
57
+ }
58
+ }
59
+
60
+ #[ $attr]
61
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "69420" ) ]
62
+ impl const $imp<& $u> for $t {
63
+ type Output = <$t as $imp<$u>>:: Output ;
64
+
65
+ #[ inline]
66
+ fn $method( self , other: & $u) -> <$t as $imp<$u>>:: Output {
67
+ $imp:: $method( self , * other)
68
+ }
69
+ }
70
+
71
+ #[ $attr]
72
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "69420" ) ]
73
+ impl const $imp<& $u> for & $t {
74
+ type Output = <$t as $imp<$u>>:: Output ;
75
+
76
+ #[ inline]
77
+ fn $method( self , other: & $u) -> <$t as $imp<$u>>:: Output {
78
+ $imp:: $method( * self , * other)
79
+ }
80
+ }
81
+ } ;
28
82
( impl $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
29
83
#[ $attr]
30
84
impl <' a> $imp<$u> for & ' a $t {
@@ -65,6 +119,20 @@ macro_rules! forward_ref_op_assign {
65
119
forward_ref_op_assign!( impl $imp, $method for $t, $u,
66
120
#[ stable( feature = "op_assign_builtins_by_ref" , since = "1.22.0" ) ] ) ;
67
121
} ;
122
+ ( impl const $imp: ident, $method: ident for $t: ty, $u: ty) => {
123
+ forward_ref_op_assign!( impl const $imp, $method for $t, $u,
124
+ #[ stable( feature = "op_assign_builtins_by_ref" , since = "1.22.0" ) ] ) ;
125
+ } ;
126
+ ( impl const $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
127
+ #[ $attr]
128
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "69420" ) ]
129
+ impl const $imp<& $u> for $t {
130
+ #[ inline]
131
+ fn $method( & mut self , other: & $u) {
132
+ $imp:: $method( self , * other) ;
133
+ }
134
+ }
135
+ } ;
68
136
( impl $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
69
137
#[ $attr]
70
138
impl $imp<& $u> for $t {
0 commit comments