@@ -51,46 +51,6 @@ pub(crate) struct GlobalTestOptions {
5151 pub ( crate ) args_file : PathBuf ,
5252}
5353
54- /// Function used to split command line arguments just like a shell would.
55- fn split_args ( args : & str ) -> Vec < String > {
56- let mut out = Vec :: new ( ) ;
57- let mut iter = args. chars ( ) ;
58- let mut current = String :: new ( ) ;
59-
60- while let Some ( c) = iter. next ( ) {
61- if c == '\\' {
62- if let Some ( c) = iter. next ( ) {
63- // If it's escaped, even a quote or a whitespace will be ignored.
64- current. push ( c) ;
65- }
66- } else if c == '"' || c == '\'' {
67- while let Some ( new_c) = iter. next ( ) {
68- if new_c == c {
69- break ;
70- } else if new_c == '\\' {
71- if let Some ( c) = iter. next ( ) {
72- // If it's escaped, even a quote will be ignored.
73- current. push ( c) ;
74- }
75- } else {
76- current. push ( new_c) ;
77- }
78- }
79- } else if " \n \t \r " . contains ( c) {
80- if !current. is_empty ( ) {
81- out. push ( current. clone ( ) ) ;
82- current. clear ( ) ;
83- }
84- } else {
85- current. push ( c) ;
86- }
87- }
88- if !current. is_empty ( ) {
89- out. push ( current) ;
90- }
91- out
92- }
93-
9454pub ( crate ) fn generate_args_file ( file_path : & Path , options : & RustdocOptions ) -> Result < ( ) , String > {
9555 let mut file = File :: create ( file_path)
9656 . map_err ( |error| format ! ( "failed to create args file: {error:?}" ) ) ?;
@@ -119,9 +79,7 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
11979 content. push ( format ! ( "-Z{unstable_option_str}" ) ) ;
12080 }
12181
122- for compilation_args in & options. doctest_compilation_args {
123- content. extend ( split_args ( compilation_args) ) ;
124- }
82+ content. extend ( options. doctest_build_args . clone ( ) ) ;
12583
12684 let content = content. join ( "\n " ) ;
12785
0 commit comments