@@ -960,6 +960,16 @@ struct ScrapedDoctest {
960
960
text : String ,
961
961
}
962
962
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
+
963
973
pub ( crate ) trait DoctestVisitor {
964
974
fn visit_test ( & mut self , test : String , config : LangString , rel_line : MdRelLine ) ;
965
975
fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
@@ -1009,10 +1019,8 @@ impl CreateRunnableDoctests {
1009
1019
let name = self . generate_name ( & test. filename , test. line , & test. logical_path ) ;
1010
1020
let crate_name = self . crate_name . clone ( ) ;
1011
1021
let opts = self . opts . clone ( ) ;
1012
- let edition = test. langstr . edition . unwrap_or ( self . rustdoc_options . edition ) ;
1013
1022
let target_str = self . rustdoc_options . target . to_string ( ) ;
1014
1023
let unused_externs = self . unused_extern_reports . clone ( ) ;
1015
- let no_run = test. langstr . no_run || self . rustdoc_options . no_run ;
1016
1024
if !test. langstr . compile_fail {
1017
1025
self . compiling_test_count . fetch_add ( 1 , Ordering :: SeqCst ) ;
1018
1026
}
@@ -1073,17 +1081,15 @@ impl CreateRunnableDoctests {
1073
1081
// compiler failures are test failures
1074
1082
should_panic : test:: ShouldPanic :: No ,
1075
1083
compile_fail : test. langstr . compile_fail ,
1076
- no_run,
1084
+ no_run : test . no_run ( & rustdoc_options ) ,
1077
1085
test_type : test:: TestType :: DocTest ,
1078
1086
} ,
1079
1087
testfn : test:: DynTestFn ( Box :: new ( move || {
1080
1088
doctest_run_fn (
1081
1089
RunnableDoctest {
1082
1090
crate_name,
1083
1091
rustdoc_test_options,
1084
- no_run,
1085
1092
opts,
1086
- edition,
1087
1093
path,
1088
1094
scraped_test : test,
1089
1095
} ,
@@ -1099,9 +1105,7 @@ impl CreateRunnableDoctests {
1099
1105
struct RunnableDoctest {
1100
1106
crate_name : String ,
1101
1107
rustdoc_test_options : IndividualTestOptions ,
1102
- no_run : bool ,
1103
1108
opts : GlobalTestOptions ,
1104
- edition : Edition ,
1105
1109
path : PathBuf ,
1106
1110
scraped_test : ScrapedDoctest ,
1107
1111
}
@@ -1114,16 +1118,18 @@ fn doctest_run_fn(
1114
1118
let report_unused_externs = |uext| {
1115
1119
unused_externs. lock ( ) . unwrap ( ) . push ( uext) ;
1116
1120
} ;
1121
+ let no_run = runnable_test. scraped_test . no_run ( & rustdoc_options) ;
1122
+ let edition = runnable_test. scraped_test . edition ( & rustdoc_options) ;
1117
1123
let res = run_test (
1118
1124
& runnable_test. scraped_test . text ,
1119
1125
& runnable_test. crate_name ,
1120
1126
runnable_test. scraped_test . line ,
1121
1127
& rustdoc_options,
1122
1128
runnable_test. rustdoc_test_options ,
1123
1129
runnable_test. scraped_test . langstr ,
1124
- runnable_test . no_run ,
1130
+ no_run,
1125
1131
& runnable_test. opts ,
1126
- runnable_test . edition ,
1132
+ edition,
1127
1133
runnable_test. path ,
1128
1134
report_unused_externs,
1129
1135
) ;
0 commit comments