@@ -961,6 +961,16 @@ struct ScrapedDoctest {
961961 text : String ,
962962}
963963
964+ impl ScrapedDoctest {
965+ fn edition ( & self , opts : & RustdocOptions ) -> Edition {
966+ self . langstr . edition . unwrap_or ( opts. edition )
967+ }
968+
969+ fn no_run ( & self , opts : & RustdocOptions ) -> bool {
970+ self . langstr . no_run || opts. no_run
971+ }
972+ }
973+
964974pub ( crate ) trait DoctestVisitor {
965975 fn visit_test ( & mut self , test : String , config : LangString , rel_line : MdRelLine ) ;
966976 fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
@@ -1010,10 +1020,8 @@ impl CreateRunnableDoctests {
10101020 let name = self . generate_name ( & test. filename , test. line , & test. logical_path ) ;
10111021 let crate_name = self . crate_name . clone ( ) ;
10121022 let opts = self . opts . clone ( ) ;
1013- let edition = test. langstr . edition . unwrap_or ( self . rustdoc_options . edition ) ;
10141023 let target_str = self . rustdoc_options . target . to_string ( ) ;
10151024 let unused_externs = self . unused_extern_reports . clone ( ) ;
1016- let no_run = test. langstr . no_run || self . rustdoc_options . no_run ;
10171025 if !test. langstr . compile_fail {
10181026 self . compiling_test_count . fetch_add ( 1 , Ordering :: SeqCst ) ;
10191027 }
@@ -1074,17 +1082,15 @@ impl CreateRunnableDoctests {
10741082 // compiler failures are test failures
10751083 should_panic : test:: ShouldPanic :: No ,
10761084 compile_fail : test. langstr . compile_fail ,
1077- no_run,
1085+ no_run : test . no_run ( & rustdoc_options ) ,
10781086 test_type : test:: TestType :: DocTest ,
10791087 } ,
10801088 testfn : test:: DynTestFn ( Box :: new ( move || {
10811089 doctest_run_fn (
10821090 RunnableDoctest {
10831091 crate_name,
10841092 rustdoc_test_options,
1085- no_run,
10861093 opts,
1087- edition,
10881094 path,
10891095 scraped_test : test,
10901096 } ,
@@ -1100,9 +1106,7 @@ impl CreateRunnableDoctests {
11001106struct RunnableDoctest {
11011107 crate_name : String ,
11021108 rustdoc_test_options : IndividualTestOptions ,
1103- no_run : bool ,
11041109 opts : GlobalTestOptions ,
1105- edition : Edition ,
11061110 path : PathBuf ,
11071111 scraped_test : ScrapedDoctest ,
11081112}
@@ -1115,16 +1119,18 @@ fn doctest_run_fn(
11151119 let report_unused_externs = |uext| {
11161120 unused_externs. lock ( ) . unwrap ( ) . push ( uext) ;
11171121 } ;
1122+ let no_run = runnable_test. scraped_test . no_run ( & rustdoc_options) ;
1123+ let edition = runnable_test. scraped_test . edition ( & rustdoc_options) ;
11181124 let res = run_test (
11191125 & runnable_test. scraped_test . text ,
11201126 & runnable_test. crate_name ,
11211127 runnable_test. scraped_test . line ,
11221128 & rustdoc_options,
11231129 runnable_test. rustdoc_test_options ,
11241130 runnable_test. scraped_test . langstr ,
1125- runnable_test . no_run ,
1131+ no_run,
11261132 & runnable_test. opts ,
1127- runnable_test . edition ,
1133+ edition,
11281134 runnable_test. path ,
11291135 report_unused_externs,
11301136 ) ;
0 commit comments