File tree 4 files changed +28
-10
lines changed
tests/run-make/rustdoc-target-spec-json-path
4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ impl Rustdoc {
123
123
self
124
124
}
125
125
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
+
126
132
/// Specify the crate type.
127
133
pub fn crate_type ( & mut self , crate_type : & str ) -> & mut Self {
128
134
self . cmd . arg ( "--crate-type" ) ;
@@ -137,6 +143,14 @@ impl Rustdoc {
137
143
self
138
144
}
139
145
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
+
140
154
#[ track_caller]
141
155
pub fn run_fail_assert_exit_code ( & mut self , code : i32 ) -> Output {
142
156
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
248
248
run-make/rustdoc-scrape-examples-remap/Makefile
249
249
run-make/rustdoc-scrape-examples-test/Makefile
250
250
run-make/rustdoc-scrape-examples-whitespace/Makefile
251
- run-make/rustdoc-target-spec-json-path/Makefile
252
251
run-make/rustdoc-themes/Makefile
253
252
run-make/rustdoc-verify-output-files/Makefile
254
253
run-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