@@ -119,11 +119,23 @@ macro_rules! __lazy_static_internal {
119
119
( $( #[ $attr: meta] ) * static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
120
120
__lazy_static_internal!( @PRIV , $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
121
121
} ;
122
+ ( $( #[ $attr: meta] ) * pub ( in $in: path) static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
123
+ __lazy_static_internal!( @PUB_IN , $in, $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
124
+ } ;
122
125
( $( #[ $attr: meta] ) * pub static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
123
126
__lazy_static_internal!( @PUB , $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
124
127
} ;
128
+ ( @PUB_IN , $in: path, $( #[ $attr: meta] ) * static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
129
+ __lazy_static_internal!( @MAKE TY , PUB_IN , $in, $( #[ $attr] ) * , $N) ;
130
+ __lazy_static_internal!( @TAIL , $N : $T = $e) ;
131
+ __lazy_static_internal!( $( $t) * ) ;
132
+ } ;
125
133
( @$VIS: ident, $( #[ $attr: meta] ) * static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
126
134
__lazy_static_internal!( @MAKE TY , $VIS, $( #[ $attr] ) * , $N) ;
135
+ __lazy_static_internal!( @TAIL , $N : $T = $e) ;
136
+ __lazy_static_internal!( $( $t) * ) ;
137
+ } ;
138
+ ( @TAIL , $N: ident : $T: ty = $e: expr) => {
127
139
impl $crate:: __Deref for $N {
128
140
type Target = $T;
129
141
#[ allow( unsafe_code) ]
@@ -146,7 +158,6 @@ macro_rules! __lazy_static_internal {
146
158
let _ = & * * lazy;
147
159
}
148
160
}
149
- __lazy_static_internal!( $( $t) * ) ;
150
161
} ;
151
162
( @MAKE TY , PUB , $( #[ $attr: meta] ) * , $N: ident) => {
152
163
#[ allow( missing_copy_implementations) ]
@@ -157,6 +168,15 @@ macro_rules! __lazy_static_internal {
157
168
#[ doc( hidden) ]
158
169
pub static $N: $N = $N { __private_field: ( ) } ;
159
170
} ;
171
+ ( @MAKE TY , PUB_IN , $in: path, $( #[ $attr: meta] ) * , $N: ident) => {
172
+ #[ allow( missing_copy_implementations) ]
173
+ #[ allow( non_camel_case_types) ]
174
+ #[ allow( dead_code) ]
175
+ $( #[ $attr] ) *
176
+ pub ( in $in) struct $N { __private_field: ( ) }
177
+ #[ doc( hidden) ]
178
+ pub ( in $in) static $N: $N = $N { __private_field: ( ) } ;
179
+ } ;
160
180
( @MAKE TY , PRIV , $( #[ $attr: meta] ) * , $N: ident) => {
161
181
#[ allow( missing_copy_implementations) ]
162
182
#[ allow( non_camel_case_types) ]
@@ -175,6 +195,9 @@ macro_rules! lazy_static {
175
195
( $( #[ $attr: meta] ) * static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
176
196
__lazy_static_internal!( @PRIV , $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
177
197
} ;
198
+ ( $( #[ $attr: meta] ) * pub ( in $in: path) static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
199
+ __lazy_static_internal!( @PUB_IN , $in, $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
200
+ } ;
178
201
( $( #[ $attr: meta] ) * pub static ref $N: ident : $T: ty = $e: expr; $( $t: tt) * ) => {
179
202
__lazy_static_internal!( @PUB , $( #[ $attr] ) * static ref $N : $T = $e; $( $t) * ) ;
180
203
} ;
0 commit comments