@@ -398,55 +398,52 @@ macro_rules! py_run_impl {
398
398
}
399
399
400
400
/// Test readme and user guide
401
- #[ doc ( hidden ) ]
401
+ #[ cfg ( doctest ) ]
402
402
pub mod doc_test {
403
- macro_rules! doc_comment {
404
- ( $x : expr, $module : item ) => {
405
- #[ doc = $x ]
406
- $module
403
+ macro_rules! doctest_impl {
404
+ ( $doc : expr, $mod : ident ) => {
405
+ #[ doc = $doc ]
406
+ mod $mod { }
407
407
} ;
408
408
}
409
409
410
410
macro_rules! doctest {
411
- ( $x : expr, $y : ident) => {
412
- doc_comment !( include_str!( $x ) , mod $y { } ) ;
411
+ ( $path : expr, $mod : ident) => {
412
+ doctest_impl !( include_str!( concat! ( "../" , $path ) ) , $mod ) ;
413
413
} ;
414
414
}
415
415
416
- doctest ! ( "../ README.md" , readme_md) ;
417
- doctest ! ( "../ guide/src/advanced.md" , guide_advanced_md) ;
416
+ doctest ! ( "README.md" , readme_md) ;
417
+ doctest ! ( "guide/src/advanced.md" , guide_advanced_md) ;
418
418
doctest ! (
419
- "../ guide/src/building_and_distribution.md" ,
419
+ "guide/src/building_and_distribution.md" ,
420
420
guide_building_and_distribution_md
421
421
) ;
422
422
doctest ! (
423
- "../ guide/src/building_and_distribution/pypy.md" ,
423
+ "guide/src/building_and_distribution/pypy.md" ,
424
424
guide_building_and_distribution_pypy_md
425
425
) ;
426
- doctest ! ( "../ guide/src/class.md" , guide_class_md) ;
427
- doctest ! ( "../ guide/src/class/protocols.md" , guide_class_protocols_md) ;
428
- doctest ! ( "../ guide/src/conversions.md" , guide_conversions_md) ;
426
+ doctest ! ( "guide/src/class.md" , guide_class_md) ;
427
+ doctest ! ( "guide/src/class/protocols.md" , guide_class_protocols_md) ;
428
+ doctest ! ( "guide/src/conversions.md" , guide_conversions_md) ;
429
429
doctest ! (
430
- "../ guide/src/conversions/tables.md" ,
430
+ "guide/src/conversions/tables.md" ,
431
431
guide_conversions_tables_md
432
432
) ;
433
433
doctest ! (
434
- "../ guide/src/conversions/traits.md" ,
434
+ "guide/src/conversions/traits.md" ,
435
435
guide_conversions_traits_md
436
436
) ;
437
- doctest ! ( "../guide/src/debugging.md" , guide_debugging_md) ;
438
- doctest ! ( "../guide/src/exception.md" , guide_exception_md) ;
439
- doctest ! ( "../guide/src/function.md" , guide_function_md) ;
440
- doctest ! ( "../guide/src/migration.md" , guide_migration_md) ;
441
- doctest ! ( "../guide/src/module.md" , guide_module_md) ;
442
- doctest ! ( "../guide/src/parallelism.md" , guide_parallelism_md) ;
443
- doctest ! (
444
- "../guide/src/python_from_rust.md" ,
445
- guide_python_from_rust_md
446
- ) ;
447
- doctest ! ( "../guide/src/rust_cpython.md" , guide_rust_cpython_md) ;
448
- doctest ! ( "../guide/src/trait_bounds.md" , guide_trait_bounds_md) ;
449
- doctest ! ( "../guide/src/types.md" , guide_types_md) ;
437
+ doctest ! ( "guide/src/debugging.md" , guide_debugging_md) ;
438
+ doctest ! ( "guide/src/exception.md" , guide_exception_md) ;
439
+ doctest ! ( "guide/src/function.md" , guide_function_md) ;
440
+ doctest ! ( "guide/src/migration.md" , guide_migration_md) ;
441
+ doctest ! ( "guide/src/module.md" , guide_module_md) ;
442
+ doctest ! ( "guide/src/parallelism.md" , guide_parallelism_md) ;
443
+ doctest ! ( "guide/src/python_from_rust.md" , guide_python_from_rust_md) ;
444
+ doctest ! ( "guide/src/rust_cpython.md" , guide_rust_cpython_md) ;
445
+ doctest ! ( "guide/src/trait_bounds.md" , guide_trait_bounds_md) ;
446
+ doctest ! ( "guide/src/types.md" , guide_types_md) ;
450
447
}
451
448
452
449
// interim helper until #[cfg(panic = ...)] is stable
0 commit comments