@@ -66,7 +66,7 @@ macro_rules! define_handles {
66
66
impl <S : server:: Types > DecodeMut <' _, ' _, HandleStore <server:: MarkedTypes <S >>>
67
67
for Marked <S :: $oty, $oty>
68
68
{
69
- fn decode( r: & mut Reader , s: & mut HandleStore <server:: MarkedTypes <S >>) -> Self {
69
+ fn decode( r: & mut Reader < ' _> , s: & mut HandleStore <server:: MarkedTypes <S >>) -> Self {
70
70
s. $oty. take( handle:: Handle :: decode( r, & mut ( ) ) )
71
71
}
72
72
}
@@ -80,7 +80,7 @@ macro_rules! define_handles {
80
80
impl <S : server:: Types > Decode <' _, ' s, HandleStore <server:: MarkedTypes <S >>>
81
81
for & ' s Marked <S :: $oty, $oty>
82
82
{
83
- fn decode( r: & mut Reader , s: & ' s HandleStore <server:: MarkedTypes <S >>) -> Self {
83
+ fn decode( r: & mut Reader < ' _> , s: & ' s HandleStore <server:: MarkedTypes <S >>) -> Self {
84
84
& s. $oty[ handle:: Handle :: decode( r, & mut ( ) ) ]
85
85
}
86
86
}
@@ -94,7 +94,10 @@ macro_rules! define_handles {
94
94
impl <S : server:: Types > DecodeMut <' _, ' s, HandleStore <server:: MarkedTypes <S >>>
95
95
for & ' s mut Marked <S :: $oty, $oty>
96
96
{
97
- fn decode( r: & mut Reader , s: & ' s mut HandleStore <server:: MarkedTypes <S >>) -> Self {
97
+ fn decode(
98
+ r: & mut Reader <' _>,
99
+ s: & ' s mut HandleStore <server:: MarkedTypes <S >>
100
+ ) -> Self {
98
101
& mut s. $oty[ handle:: Handle :: decode( r, & mut ( ) ) ]
99
102
}
100
103
}
@@ -108,7 +111,7 @@ macro_rules! define_handles {
108
111
}
109
112
110
113
impl <S > DecodeMut <' _, ' _, S > for $oty {
111
- fn decode( r: & mut Reader , s: & mut S ) -> Self {
114
+ fn decode( r: & mut Reader < ' _> , s: & mut S ) -> Self {
112
115
$oty( handle:: Handle :: decode( r, s) )
113
116
}
114
117
}
@@ -130,7 +133,7 @@ macro_rules! define_handles {
130
133
impl <S : server:: Types > DecodeMut <' _, ' _, HandleStore <server:: MarkedTypes <S >>>
131
134
for Marked <S :: $ity, $ity>
132
135
{
133
- fn decode( r: & mut Reader , s: & mut HandleStore <server:: MarkedTypes <S >>) -> Self {
136
+ fn decode( r: & mut Reader < ' _> , s: & mut HandleStore <server:: MarkedTypes <S >>) -> Self {
134
137
s. $ity. copy( handle:: Handle :: decode( r, & mut ( ) ) )
135
138
}
136
139
}
@@ -144,7 +147,7 @@ macro_rules! define_handles {
144
147
}
145
148
146
149
impl <S > DecodeMut <' _, ' _, S > for $ity {
147
- fn decode( r: & mut Reader , s: & mut S ) -> Self {
150
+ fn decode( r: & mut Reader < ' _> , s: & mut S ) -> Self {
148
151
$ity( handle:: Handle :: decode( r, s) )
149
152
}
150
153
}
@@ -200,7 +203,7 @@ impl Clone for Literal {
200
203
201
204
// FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
202
205
impl fmt:: Debug for Literal {
203
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
206
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
204
207
f. write_str ( & self . debug ( ) )
205
208
}
206
209
}
@@ -212,7 +215,7 @@ impl Clone for SourceFile {
212
215
}
213
216
214
217
impl fmt:: Debug for Span {
215
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
218
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
216
219
f. write_str ( & self . debug ( ) )
217
220
}
218
221
}
@@ -275,7 +278,7 @@ impl BridgeState<'_> {
275
278
///
276
279
/// N.B., while `f` is running, the thread-local state
277
280
/// is `BridgeState::InUse`.
278
- fn with < R > ( f : impl FnOnce ( & mut BridgeState ) -> R ) -> R {
281
+ fn with < R > ( f : impl FnOnce ( & mut BridgeState < ' _ > ) -> R ) -> R {
279
282
BRIDGE_STATE . with ( |state| {
280
283
state. replace ( BridgeState :: InUse , |mut state| {
281
284
// FIXME(#52812) pass `f` directly to `replace` when `RefMutL` is gone
@@ -306,7 +309,7 @@ impl Bridge<'_> {
306
309
BRIDGE_STATE . with ( |state| state. set ( BridgeState :: Connected ( self ) , f) )
307
310
}
308
311
309
- fn with < R > ( f : impl FnOnce ( & mut Bridge ) -> R ) -> R {
312
+ fn with < R > ( f : impl FnOnce ( & mut Bridge < ' _ > ) -> R ) -> R {
310
313
BridgeState :: with ( |state| match state {
311
314
BridgeState :: NotConnected => {
312
315
panic ! ( "procedural macro API is used outside of a procedural macro" ) ;
@@ -331,15 +334,15 @@ impl Bridge<'_> {
331
334
#[ derive( Copy , Clone ) ]
332
335
pub struct Client < F > {
333
336
pub ( super ) get_handle_counters : extern "C" fn ( ) -> & ' static HandleCounters ,
334
- pub ( super ) run : extern "C" fn ( Bridge , F ) -> Buffer < u8 > ,
337
+ pub ( super ) run : extern "C" fn ( Bridge < ' _ > , F ) -> Buffer < u8 > ,
335
338
pub ( super ) f : F ,
336
339
}
337
340
338
341
// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
339
342
// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
340
343
pub extern "C" fn __run_expand1 (
341
- mut bridge : Bridge ,
342
- f : fn ( :: TokenStream ) -> :: TokenStream ,
344
+ mut bridge : Bridge < ' _ > ,
345
+ f : fn ( crate :: TokenStream ) -> crate :: TokenStream ,
343
346
) -> Buffer < u8 > {
344
347
// The initial `cached_buffer` contains the input.
345
348
let mut b = bridge. cached_buffer . take ( ) ;
@@ -352,7 +355,7 @@ pub extern "C" fn __run_expand1(
352
355
// Put the `cached_buffer` back in the `Bridge`, for requests.
353
356
Bridge :: with ( |bridge| bridge. cached_buffer = b. take ( ) ) ;
354
357
355
- let output = f ( :: TokenStream ( input) ) . 0 ;
358
+ let output = f ( crate :: TokenStream ( input) ) . 0 ;
356
359
357
360
// Take the `cached_buffer` back out, for the output value.
358
361
b = Bridge :: with ( |bridge| bridge. cached_buffer . take ( ) ) ;
@@ -378,8 +381,8 @@ pub extern "C" fn __run_expand1(
378
381
b
379
382
}
380
383
381
- impl Client < fn ( :: TokenStream ) -> :: TokenStream > {
382
- pub const fn expand1 ( f : fn ( :: TokenStream ) -> :: TokenStream ) -> Self {
384
+ impl Client < fn ( crate :: TokenStream ) -> crate :: TokenStream > {
385
+ pub const fn expand1 ( f : fn ( crate :: TokenStream ) -> crate :: TokenStream ) -> Self {
383
386
Client {
384
387
get_handle_counters : HandleCounters :: get,
385
388
run : __run_expand1,
@@ -391,8 +394,8 @@ impl Client<fn(::TokenStream) -> ::TokenStream> {
391
394
// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
392
395
// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
393
396
pub extern "C" fn __run_expand2 (
394
- mut bridge : Bridge ,
395
- f : fn ( :: TokenStream , :: TokenStream ) -> :: TokenStream ,
397
+ mut bridge : Bridge < ' _ > ,
398
+ f : fn ( crate :: TokenStream , crate :: TokenStream ) -> crate :: TokenStream ,
396
399
) -> Buffer < u8 > {
397
400
// The initial `cached_buffer` contains the input.
398
401
let mut b = bridge. cached_buffer . take ( ) ;
@@ -406,7 +409,7 @@ pub extern "C" fn __run_expand2(
406
409
// Put the `cached_buffer` back in the `Bridge`, for requests.
407
410
Bridge :: with ( |bridge| bridge. cached_buffer = b. take ( ) ) ;
408
411
409
- let output = f ( :: TokenStream ( input) , :: TokenStream ( input2) ) . 0 ;
412
+ let output = f ( crate :: TokenStream ( input) , crate :: TokenStream ( input2) ) . 0 ;
410
413
411
414
// Take the `cached_buffer` back out, for the output value.
412
415
b = Bridge :: with ( |bridge| bridge. cached_buffer . take ( ) ) ;
@@ -432,8 +435,10 @@ pub extern "C" fn __run_expand2(
432
435
b
433
436
}
434
437
435
- impl Client < fn ( :: TokenStream , :: TokenStream ) -> :: TokenStream > {
436
- pub const fn expand2 ( f : fn ( :: TokenStream , :: TokenStream ) -> :: TokenStream ) -> Self {
438
+ impl Client < fn ( crate :: TokenStream , crate :: TokenStream ) -> crate :: TokenStream > {
439
+ pub const fn expand2 (
440
+ f : fn ( crate :: TokenStream , crate :: TokenStream ) -> crate :: TokenStream
441
+ ) -> Self {
437
442
Client {
438
443
get_handle_counters : HandleCounters :: get,
439
444
run : __run_expand2,
@@ -448,25 +453,25 @@ pub enum ProcMacro {
448
453
CustomDerive {
449
454
trait_name : & ' static str ,
450
455
attributes : & ' static [ & ' static str ] ,
451
- client : Client < fn ( :: TokenStream ) -> :: TokenStream > ,
456
+ client : Client < fn ( crate :: TokenStream ) -> crate :: TokenStream > ,
452
457
} ,
453
458
454
459
Attr {
455
460
name : & ' static str ,
456
- client : Client < fn ( :: TokenStream , :: TokenStream ) -> :: TokenStream > ,
461
+ client : Client < fn ( crate :: TokenStream , crate :: TokenStream ) -> crate :: TokenStream > ,
457
462
} ,
458
463
459
464
Bang {
460
465
name : & ' static str ,
461
- client : Client < fn ( :: TokenStream ) -> :: TokenStream > ,
466
+ client : Client < fn ( crate :: TokenStream ) -> crate :: TokenStream > ,
462
467
} ,
463
468
}
464
469
465
470
impl ProcMacro {
466
471
pub const fn custom_derive (
467
472
trait_name : & ' static str ,
468
473
attributes : & ' static [ & ' static str ] ,
469
- expand : fn ( :: TokenStream ) -> :: TokenStream ,
474
+ expand : fn ( crate :: TokenStream ) -> crate :: TokenStream ,
470
475
) -> Self {
471
476
ProcMacro :: CustomDerive {
472
477
trait_name,
@@ -477,15 +482,18 @@ impl ProcMacro {
477
482
478
483
pub const fn attr (
479
484
name : & ' static str ,
480
- expand : fn ( :: TokenStream , :: TokenStream ) -> :: TokenStream ,
485
+ expand : fn ( crate :: TokenStream , crate :: TokenStream ) -> crate :: TokenStream ,
481
486
) -> Self {
482
487
ProcMacro :: Attr {
483
488
name,
484
489
client : Client :: expand2 ( expand) ,
485
490
}
486
491
}
487
492
488
- pub const fn bang ( name : & ' static str , expand : fn ( :: TokenStream ) -> :: TokenStream ) -> Self {
493
+ pub const fn bang (
494
+ name : & ' static str ,
495
+ expand : fn ( crate :: TokenStream ) -> crate :: TokenStream
496
+ ) -> Self {
489
497
ProcMacro :: Bang {
490
498
name,
491
499
client : Client :: expand1 ( expand) ,
0 commit comments