@@ -42,9 +42,13 @@ use std::process::Command;
42
42
43
43
#[ derive( Debug ) ]
44
44
pub struct ExternArgs {
45
- edition : String , // where default value of "" means arg wasn't specified
46
- crate_name : String ,
45
+ /// rust edition as specified in manifest
46
+ pub edition : String , // where default value of "" means arg wasn't specified
47
+ /// crate name as specified in manifest
48
+ pub crate_name : String ,
49
+ // accumulated library path(s), as observed from live cargo run
47
50
lib_list : Vec < String > ,
51
+ // explicit extern crates, as observed from live cargo run
48
52
extern_list : Vec < String > ,
49
53
}
50
54
@@ -65,11 +69,18 @@ impl ExternArgs {
65
69
pub fn load ( & mut self , cargo_path : & Path ) -> Result < & Self > {
66
70
// find Cargo.toml and determine the package name and lib or bin source file.
67
71
let proj_root = cargo_path
68
- . canonicalize ( ) ?
72
+ . canonicalize ( )
73
+ . context ( format ! (
74
+ "can't find cargo manifest {}" ,
75
+ & cargo_path. to_string_lossy( )
76
+ ) ) ?
69
77
. parent ( )
70
78
. ok_or ( anyhow ! ( "can't find parent of {:?}" , cargo_path) ) ?
71
79
. to_owned ( ) ;
72
- let mut manifest = Manifest :: from_path ( & cargo_path) ?;
80
+ let mut manifest = Manifest :: from_path ( & cargo_path) . context ( format ! (
81
+ "can't open cargo manifest {}" ,
82
+ & cargo_path. to_string_lossy( )
83
+ ) ) ?;
73
84
manifest. complete_from_path ( & proj_root) ?; // try real hard to determine bin or lib
74
85
let package = manifest
75
86
. package
@@ -204,10 +215,6 @@ impl ExternArgs {
204
215
/// provide the parsed external args used to invoke rustdoc (--edition, -L and --extern).
205
216
pub fn get_args ( & self ) -> Vec < String > {
206
217
let mut ret_val: Vec < String > = vec ! [ ] ;
207
- if self . edition != "" {
208
- ret_val. push ( "--edition" . to_owned ( ) ) ;
209
- ret_val. push ( self . edition . clone ( ) ) ;
210
- } ;
211
218
for i in & self . lib_list {
212
219
ret_val. push ( "-L" . to_owned ( ) ) ;
213
220
ret_val. push ( i. clone ( ) ) ;
0 commit comments