File tree Expand file tree Collapse file tree 4 files changed +28
-10
lines changed
tests/run-make/rustdoc-target-spec-json-path Expand file tree Collapse file tree 4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ impl Rustdoc {
123123 self
124124 }
125125
126+ /// Specify the target triple, or a path to a custom target json spec file.
127+ pub fn target ( & mut self , target : & str ) -> & mut Self {
128+ self . cmd . arg ( format ! ( "--target={target}" ) ) ;
129+ self
130+ }
131+
126132 /// Specify the crate type.
127133 pub fn crate_type ( & mut self , crate_type : & str ) -> & mut Self {
128134 self . cmd . arg ( "--crate-type" ) ;
@@ -137,6 +143,14 @@ impl Rustdoc {
137143 self
138144 }
139145
146+ /// Add a directory to the library search path. It corresponds to the `-L`
147+ /// rustdoc option.
148+ pub fn library_search_path < P : AsRef < Path > > ( & mut self , path : P ) -> & mut Self {
149+ self . cmd . arg ( "-L" ) ;
150+ self . cmd . arg ( path. as_ref ( ) ) ;
151+ self
152+ }
153+
140154 #[ track_caller]
141155 pub fn run_fail_assert_exit_code ( & mut self , code : i32 ) -> Output {
142156 let caller_location = std:: panic:: Location :: caller ( ) ;
Original file line number Diff line number Diff line change @@ -248,7 +248,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile
248248run-make/rustdoc-scrape-examples-remap/Makefile
249249run-make/rustdoc-scrape-examples-test/Makefile
250250run-make/rustdoc-scrape-examples-whitespace/Makefile
251- run-make/rustdoc-target-spec-json-path/Makefile
252251run-make/rustdoc-themes/Makefile
253252run-make/rustdoc-verify-output-files/Makefile
254253run-make/rustdoc-with-out-dir-option/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // Test that rustdoc will properly canonicalize the target spec json path just like rustc.
2+
3+ use run_make_support:: { rustc, rustdoc, tmp_dir} ;
4+
5+ fn main ( ) {
6+ let out_dir = tmp_dir ( ) . join ( "rustdoc-target-spec-json-path" ) ;
7+ rustc ( ) . crate_type ( "lib" ) . input ( "dummy_core.rs" ) . target ( "target.json" ) . run ( ) ;
8+ rustdoc ( )
9+ . input ( "my_crate.rs" )
10+ . output ( out_dir)
11+ . library_search_path ( tmp_dir ( ) )
12+ . target ( "target.json" )
13+ . run ( ) ;
14+ }
You can’t perform that action at this time.
0 commit comments