@@ -57,12 +57,13 @@ impl Idx for u32 {
5757/// `u32::MAX`. You can also customize things like the `Debug` impl,
5858/// what traits are derived, and so forth via the macro.
5959#[ macro_export]
60+ #[ allow_internal_unstable( step_trait, rustc_attrs) ]
6061macro_rules! newtype_index {
6162 // ---- public rules ----
6263
6364 // Use default constants
6465 ( $( #[ $attrs: meta] ) * $v: vis struct $name: ident { .. } ) => (
65- newtype_index!(
66+ $crate :: newtype_index!(
6667 // Leave out derives marker so we can use its absence to ensure it comes first
6768 @attrs [ $( #[ $attrs] ) * ]
6869 @type [ $name]
@@ -74,7 +75,7 @@ macro_rules! newtype_index {
7475
7576 // Define any constants
7677 ( $( #[ $attrs: meta] ) * $v: vis struct $name: ident { $( $tokens: tt) + } ) => (
77- newtype_index!(
78+ $crate :: newtype_index!(
7879 // Leave out derives marker so we can use its absence to ensure it comes first
7980 @attrs [ $( #[ $attrs] ) * ]
8081 @type [ $name]
@@ -258,7 +259,7 @@ macro_rules! newtype_index {
258259 }
259260 }
260261
261- newtype_index!(
262+ $crate :: newtype_index!(
262263 @handle_debug
263264 @derives [ $( $derives, ) * ]
264265 @type [ $type]
@@ -294,7 +295,7 @@ macro_rules! newtype_index {
294295 @derives [ $_derive: ident, $( $derives: ident, ) * ]
295296 @type [ $type: ident]
296297 @debug_format [ $debug_format: tt] ) => (
297- newtype_index!(
298+ $crate :: newtype_index!(
298299 @handle_debug
299300 @derives [ $( $derives, ) * ]
300301 @type [ $type]
@@ -309,7 +310,7 @@ macro_rules! newtype_index {
309310 @debug_format [ $debug_format: tt]
310311 derive [ $( $derives: ident) ,* ]
311312 $( $tokens: tt) * ) => (
312- newtype_index!(
313+ $crate :: newtype_index!(
313314 @attrs [ $( #[ $attrs] ) * ]
314315 @type [ $type]
315316 @max [ $max]
@@ -329,7 +330,7 @@ macro_rules! newtype_index {
329330 derive [ $( $derives: ident, ) +]
330331 ENCODABLE = custom
331332 $( $tokens: tt) * ) => (
332- newtype_index!(
333+ $crate :: newtype_index!(
333334 @attrs [ $( #[ $attrs] ) * ]
334335 @derives [ $( $derives, ) +]
335336 @type [ $type]
@@ -348,15 +349,15 @@ macro_rules! newtype_index {
348349 @debug_format [ $debug_format: tt]
349350 derive [ $( $derives: ident, ) +]
350351 $( $tokens: tt) * ) => (
351- newtype_index!(
352+ $crate :: newtype_index!(
352353 @derives [ $( $derives, ) + RustcEncodable , ]
353354 @attrs [ $( #[ $attrs] ) * ]
354355 @type [ $type]
355356 @max [ $max]
356357 @vis [ $v]
357358 @debug_format [ $debug_format]
358359 $( $tokens) * ) ;
359- newtype_index!( @decodable $type) ;
360+ $crate :: newtype_index!( @decodable $type) ;
360361 ) ;
361362
362363 // The case where no derives are added, but encodable is overridden. Don't
@@ -368,7 +369,7 @@ macro_rules! newtype_index {
368369 @debug_format [ $debug_format: tt]
369370 ENCODABLE = custom
370371 $( $tokens: tt) * ) => (
371- newtype_index!(
372+ $crate :: newtype_index!(
372373 @derives [ ]
373374 @attrs [ $( #[ $attrs] ) * ]
374375 @type [ $type]
@@ -385,15 +386,15 @@ macro_rules! newtype_index {
385386 @vis [ $v: vis]
386387 @debug_format [ $debug_format: tt]
387388 $( $tokens: tt) * ) => (
388- newtype_index!(
389+ $crate :: newtype_index!(
389390 @derives [ RustcEncodable , ]
390391 @attrs [ $( #[ $attrs] ) * ]
391392 @type [ $type]
392393 @max [ $max]
393394 @vis [ $v]
394395 @debug_format [ $debug_format]
395396 $( $tokens) * ) ;
396- newtype_index!( @decodable $type) ;
397+ $crate :: newtype_index!( @decodable $type) ;
397398 ) ;
398399
399400 ( @decodable $type: ident) => (
@@ -420,7 +421,7 @@ macro_rules! newtype_index {
420421 @vis [ $v: vis]
421422 @debug_format [ $debug_format: tt]
422423 $name: ident = $constant: expr) => (
423- newtype_index!(
424+ $crate :: newtype_index!(
424425 @derives [ $( $derives, ) * ]
425426 @attrs [ $( #[ $attrs] ) * ]
426427 @type [ $type]
@@ -439,7 +440,7 @@ macro_rules! newtype_index {
439440 @debug_format [ $debug_format: tt]
440441 $( #[ doc = $doc: expr] ) *
441442 const $name: ident = $constant: expr) => (
442- newtype_index!(
443+ $crate :: newtype_index!(
443444 @derives [ $( $derives, ) * ]
444445 @attrs [ $( #[ $attrs] ) * ]
445446 @type [ $type]
@@ -458,7 +459,7 @@ macro_rules! newtype_index {
458459 @debug_format [ $debug_format: tt]
459460 MAX = $max: expr,
460461 $( $tokens: tt) * ) => (
461- newtype_index!(
462+ $crate :: newtype_index!(
462463 @derives [ $( $derives, ) * ]
463464 @attrs [ $( #[ $attrs] ) * ]
464465 @type [ $type]
@@ -477,7 +478,7 @@ macro_rules! newtype_index {
477478 @debug_format [ $_debug_format: tt]
478479 DEBUG_FORMAT = $debug_format: tt,
479480 $( $tokens: tt) * ) => (
480- newtype_index!(
481+ $crate :: newtype_index!(
481482 @derives [ $( $derives, ) * ]
482483 @attrs [ $( #[ $attrs] ) * ]
483484 @type [ $type]
@@ -499,7 +500,7 @@ macro_rules! newtype_index {
499500 $( $tokens: tt) * ) => (
500501 $( #[ doc = $doc] ) *
501502 pub const $name: $type = $type:: from_u32_const( $constant) ;
502- newtype_index!(
503+ $crate :: newtype_index!(
503504 @derives [ $( $derives, ) * ]
504505 @attrs [ $( #[ $attrs] ) * ]
505506 @type [ $type]
0 commit comments