@@ -105,7 +105,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
105
105
registry : rustc_driver:: diagnostics_registry ( ) ,
106
106
} ;
107
107
108
- let mut test_args = options. test_args . clone ( ) ;
108
+ let test_args = options. test_args . clone ( ) ;
109
109
let display_warnings = options. display_warnings ;
110
110
let nocapture = options. nocapture ;
111
111
let externs = options. externs . clone ( ) ;
@@ -166,12 +166,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
166
166
Err ( ErrorReported ) => return Err ( ErrorReported ) ,
167
167
} ;
168
168
169
- test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
170
- if nocapture {
171
- test_args. push ( "--nocapture" . to_string ( ) ) ;
172
- }
173
-
174
- test:: test_main ( & test_args, tests, Some ( test:: Options :: new ( ) . display_output ( display_warnings) ) ) ;
169
+ run_tests ( test_args, nocapture, display_warnings, tests) ;
175
170
176
171
// Collect and warn about unused externs, but only if we've gotten
177
172
// reports for each doctest
@@ -214,6 +209,19 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
214
209
Ok ( ( ) )
215
210
}
216
211
212
+ crate fn run_tests (
213
+ mut test_args : Vec < String > ,
214
+ nocapture : bool ,
215
+ display_warnings : bool ,
216
+ tests : Vec < test:: TestDescAndFn > ,
217
+ ) {
218
+ test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
219
+ if nocapture {
220
+ test_args. push ( "--nocapture" . to_string ( ) ) ;
221
+ }
222
+ test:: test_main ( & test_args, tests, Some ( test:: Options :: new ( ) . display_output ( display_warnings) ) ) ;
223
+ }
224
+
217
225
// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
218
226
fn scrape_test_config ( attrs : & [ ast:: Attribute ] ) -> TestOptions {
219
227
use rustc_ast_pretty:: pprust;
0 commit comments