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