@@ -960,6 +960,16 @@ struct ScrapedDoctest {
960960 text : String ,
961961}
962962
963+ impl ScrapedDoctest {
964+ fn edition ( & self , opts : & RustdocOptions ) -> Edition {
965+ self . langstr . edition . unwrap_or ( opts. edition )
966+ }
967+
968+ fn no_run ( & self , opts : & RustdocOptions ) -> bool {
969+ self . langstr . no_run || opts. no_run
970+ }
971+ }
972+
963973pub ( crate ) trait DoctestVisitor {
964974 fn visit_test ( & mut self , test : String , config : LangString , rel_line : MdRelLine ) ;
965975 fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
@@ -1009,10 +1019,8 @@ impl CreateRunnableDoctests {
10091019 let name = self . generate_name ( & test. filename , test. line , & test. logical_path ) ;
10101020 let crate_name = self . crate_name . clone ( ) ;
10111021 let opts = self . opts . clone ( ) ;
1012- let edition = test. langstr . edition . unwrap_or ( self . rustdoc_options . edition ) ;
10131022 let target_str = self . rustdoc_options . target . to_string ( ) ;
10141023 let unused_externs = self . unused_extern_reports . clone ( ) ;
1015- let no_run = test. langstr . no_run || self . rustdoc_options . no_run ;
10161024 if !test. langstr . compile_fail {
10171025 self . compiling_test_count . fetch_add ( 1 , Ordering :: SeqCst ) ;
10181026 }
@@ -1073,17 +1081,15 @@ impl CreateRunnableDoctests {
10731081 // compiler failures are test failures
10741082 should_panic : test:: ShouldPanic :: No ,
10751083 compile_fail : test. langstr . compile_fail ,
1076- no_run,
1084+ no_run : test . no_run ( & rustdoc_options ) ,
10771085 test_type : test:: TestType :: DocTest ,
10781086 } ,
10791087 testfn : test:: DynTestFn ( Box :: new ( move || {
10801088 doctest_run_fn (
10811089 RunnableDoctest {
10821090 crate_name,
10831091 rustdoc_test_options,
1084- no_run,
10851092 opts,
1086- edition,
10871093 path,
10881094 scraped_test : test,
10891095 } ,
@@ -1099,9 +1105,7 @@ impl CreateRunnableDoctests {
10991105struct RunnableDoctest {
11001106 crate_name : String ,
11011107 rustdoc_test_options : IndividualTestOptions ,
1102- no_run : bool ,
11031108 opts : GlobalTestOptions ,
1104- edition : Edition ,
11051109 path : PathBuf ,
11061110 scraped_test : ScrapedDoctest ,
11071111}
@@ -1114,16 +1118,18 @@ fn doctest_run_fn(
11141118 let report_unused_externs = |uext| {
11151119 unused_externs. lock ( ) . unwrap ( ) . push ( uext) ;
11161120 } ;
1121+ let no_run = runnable_test. scraped_test . no_run ( & rustdoc_options) ;
1122+ let edition = runnable_test. scraped_test . edition ( & rustdoc_options) ;
11171123 let res = run_test (
11181124 & runnable_test. scraped_test . text ,
11191125 & runnable_test. crate_name ,
11201126 runnable_test. scraped_test . line ,
11211127 & rustdoc_options,
11221128 runnable_test. rustdoc_test_options ,
11231129 runnable_test. scraped_test . langstr ,
1124- runnable_test . no_run ,
1130+ no_run,
11251131 & runnable_test. opts ,
1126- runnable_test . edition ,
1132+ edition,
11271133 runnable_test. path ,
11281134 report_unused_externs,
11291135 ) ;
0 commit comments