@@ -57,12 +57,13 @@ impl Idx for u32 {
57
57
/// `u32::MAX`. You can also customize things like the `Debug` impl,
58
58
/// what traits are derived, and so forth via the macro.
59
59
#[ macro_export]
60
+ #[ allow_internal_unstable( step_trait, rustc_attrs) ]
60
61
macro_rules! newtype_index {
61
62
// ---- public rules ----
62
63
63
64
// Use default constants
64
65
( $( #[ $attrs: meta] ) * $v: vis struct $name: ident { .. } ) => (
65
- newtype_index!(
66
+ $crate :: newtype_index!(
66
67
// Leave out derives marker so we can use its absence to ensure it comes first
67
68
@attrs [ $( #[ $attrs] ) * ]
68
69
@type [ $name]
@@ -74,7 +75,7 @@ macro_rules! newtype_index {
74
75
75
76
// Define any constants
76
77
( $( #[ $attrs: meta] ) * $v: vis struct $name: ident { $( $tokens: tt) + } ) => (
77
- newtype_index!(
78
+ $crate :: newtype_index!(
78
79
// Leave out derives marker so we can use its absence to ensure it comes first
79
80
@attrs [ $( #[ $attrs] ) * ]
80
81
@type [ $name]
@@ -258,7 +259,7 @@ macro_rules! newtype_index {
258
259
}
259
260
}
260
261
261
- newtype_index!(
262
+ $crate :: newtype_index!(
262
263
@handle_debug
263
264
@derives [ $( $derives, ) * ]
264
265
@type [ $type]
@@ -294,7 +295,7 @@ macro_rules! newtype_index {
294
295
@derives [ $_derive: ident, $( $derives: ident, ) * ]
295
296
@type [ $type: ident]
296
297
@debug_format [ $debug_format: tt] ) => (
297
- newtype_index!(
298
+ $crate :: newtype_index!(
298
299
@handle_debug
299
300
@derives [ $( $derives, ) * ]
300
301
@type [ $type]
@@ -309,7 +310,7 @@ macro_rules! newtype_index {
309
310
@debug_format [ $debug_format: tt]
310
311
derive [ $( $derives: ident) ,* ]
311
312
$( $tokens: tt) * ) => (
312
- newtype_index!(
313
+ $crate :: newtype_index!(
313
314
@attrs [ $( #[ $attrs] ) * ]
314
315
@type [ $type]
315
316
@max [ $max]
@@ -329,7 +330,7 @@ macro_rules! newtype_index {
329
330
derive [ $( $derives: ident, ) +]
330
331
ENCODABLE = custom
331
332
$( $tokens: tt) * ) => (
332
- newtype_index!(
333
+ $crate :: newtype_index!(
333
334
@attrs [ $( #[ $attrs] ) * ]
334
335
@derives [ $( $derives, ) +]
335
336
@type [ $type]
@@ -348,15 +349,15 @@ macro_rules! newtype_index {
348
349
@debug_format [ $debug_format: tt]
349
350
derive [ $( $derives: ident, ) +]
350
351
$( $tokens: tt) * ) => (
351
- newtype_index!(
352
+ $crate :: newtype_index!(
352
353
@derives [ $( $derives, ) + RustcEncodable , ]
353
354
@attrs [ $( #[ $attrs] ) * ]
354
355
@type [ $type]
355
356
@max [ $max]
356
357
@vis [ $v]
357
358
@debug_format [ $debug_format]
358
359
$( $tokens) * ) ;
359
- newtype_index!( @decodable $type) ;
360
+ $crate :: newtype_index!( @decodable $type) ;
360
361
) ;
361
362
362
363
// The case where no derives are added, but encodable is overridden. Don't
@@ -368,7 +369,7 @@ macro_rules! newtype_index {
368
369
@debug_format [ $debug_format: tt]
369
370
ENCODABLE = custom
370
371
$( $tokens: tt) * ) => (
371
- newtype_index!(
372
+ $crate :: newtype_index!(
372
373
@derives [ ]
373
374
@attrs [ $( #[ $attrs] ) * ]
374
375
@type [ $type]
@@ -385,15 +386,15 @@ macro_rules! newtype_index {
385
386
@vis [ $v: vis]
386
387
@debug_format [ $debug_format: tt]
387
388
$( $tokens: tt) * ) => (
388
- newtype_index!(
389
+ $crate :: newtype_index!(
389
390
@derives [ RustcEncodable , ]
390
391
@attrs [ $( #[ $attrs] ) * ]
391
392
@type [ $type]
392
393
@max [ $max]
393
394
@vis [ $v]
394
395
@debug_format [ $debug_format]
395
396
$( $tokens) * ) ;
396
- newtype_index!( @decodable $type) ;
397
+ $crate :: newtype_index!( @decodable $type) ;
397
398
) ;
398
399
399
400
( @decodable $type: ident) => (
@@ -420,7 +421,7 @@ macro_rules! newtype_index {
420
421
@vis [ $v: vis]
421
422
@debug_format [ $debug_format: tt]
422
423
$name: ident = $constant: expr) => (
423
- newtype_index!(
424
+ $crate :: newtype_index!(
424
425
@derives [ $( $derives, ) * ]
425
426
@attrs [ $( #[ $attrs] ) * ]
426
427
@type [ $type]
@@ -439,7 +440,7 @@ macro_rules! newtype_index {
439
440
@debug_format [ $debug_format: tt]
440
441
$( #[ doc = $doc: expr] ) *
441
442
const $name: ident = $constant: expr) => (
442
- newtype_index!(
443
+ $crate :: newtype_index!(
443
444
@derives [ $( $derives, ) * ]
444
445
@attrs [ $( #[ $attrs] ) * ]
445
446
@type [ $type]
@@ -458,7 +459,7 @@ macro_rules! newtype_index {
458
459
@debug_format [ $debug_format: tt]
459
460
MAX = $max: expr,
460
461
$( $tokens: tt) * ) => (
461
- newtype_index!(
462
+ $crate :: newtype_index!(
462
463
@derives [ $( $derives, ) * ]
463
464
@attrs [ $( #[ $attrs] ) * ]
464
465
@type [ $type]
@@ -477,7 +478,7 @@ macro_rules! newtype_index {
477
478
@debug_format [ $_debug_format: tt]
478
479
DEBUG_FORMAT = $debug_format: tt,
479
480
$( $tokens: tt) * ) => (
480
- newtype_index!(
481
+ $crate :: newtype_index!(
481
482
@derives [ $( $derives, ) * ]
482
483
@attrs [ $( #[ $attrs] ) * ]
483
484
@type [ $type]
@@ -499,7 +500,7 @@ macro_rules! newtype_index {
499
500
$( $tokens: tt) * ) => (
500
501
$( #[ doc = $doc] ) *
501
502
pub const $name: $type = $type:: from_u32_const( $constant) ;
502
- newtype_index!(
503
+ $crate :: newtype_index!(
503
504
@derives [ $( $derives, ) * ]
504
505
@attrs [ $( #[ $attrs] ) * ]
505
506
@type [ $type]
0 commit comments