@@ -42,9 +42,13 @@ use std::process::Command;
4242
4343#[ derive( Debug ) ]
4444pub 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
4750 lib_list : Vec < String > ,
51+ // explicit extern crates, as observed from live cargo run
4852 extern_list : Vec < String > ,
4953}
5054
@@ -65,11 +69,18 @@ impl ExternArgs {
6569 pub fn load ( & mut self , cargo_path : & Path ) -> Result < & Self > {
6670 // find Cargo.toml and determine the package name and lib or bin source file.
6771 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+ ) ) ?
6977 . parent ( )
7078 . ok_or ( anyhow ! ( "can't find parent of {:?}" , cargo_path) ) ?
7179 . 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+ ) ) ?;
7384 manifest. complete_from_path ( & proj_root) ?; // try real hard to determine bin or lib
7485 let package = manifest
7586 . package
@@ -204,10 +215,6 @@ impl ExternArgs {
204215 /// provide the parsed external args used to invoke rustdoc (--edition, -L and --extern).
205216 pub fn get_args ( & self ) -> Vec < String > {
206217 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- } ;
211218 for i in & self . lib_list {
212219 ret_val. push ( "-L" . to_owned ( ) ) ;
213220 ret_val. push ( i. clone ( ) ) ;
0 commit comments