@@ -5,6 +5,22 @@ macro_rules! forward_ref_unop {
55 forward_ref_unop!( impl $imp, $method for $t,
66 #[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
77 } ;
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 = "90080" ) ]
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+ } ;
824 ( impl $imp: ident, $method: ident for $t: ty, #[ $attr: meta] ) => {
925 #[ $attr]
1026 impl $imp for & $t {
@@ -25,6 +41,44 @@ macro_rules! forward_ref_binop {
2541 forward_ref_binop!( impl $imp, $method for $t, $u,
2642 #[ stable( feature = "rust1" , since = "1.0.0" ) ] ) ;
2743 } ;
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 = "90080" ) ]
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 = "90080" ) ]
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 = "90080" ) ]
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+ } ;
2882 ( impl $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
2983 #[ $attr]
3084 impl <' a> $imp<$u> for & ' a $t {
@@ -65,6 +119,20 @@ macro_rules! forward_ref_op_assign {
65119 forward_ref_op_assign!( impl $imp, $method for $t, $u,
66120 #[ stable( feature = "op_assign_builtins_by_ref" , since = "1.22.0" ) ] ) ;
67121 } ;
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 = "90080" ) ]
129+ impl const $imp<& $u> for $t {
130+ #[ inline]
131+ fn $method( & mut self , other: & $u) {
132+ $imp:: $method( self , * other) ;
133+ }
134+ }
135+ } ;
68136 ( impl $imp: ident, $method: ident for $t: ty, $u: ty, #[ $attr: meta] ) => {
69137 #[ $attr]
70138 impl $imp<& $u> for $t {
0 commit comments