Rollup merge of #36586 - japaric:rustdoc-sysroot, r=alexcrichton
rustdoc: implement --sysroot with the same semantics as rustc. This let us build documentation for a crate that depends on a custom sysroot. r? @alexcrichton cc @cbiffle
This commit is contained in:
commit
3775be853e
2 changed files with 7 additions and 3 deletions
|
|
@ -32,6 +32,7 @@ use errors::emitter::ColorConfig;
|
|||
use std::cell::{RefCell, Cell};
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use visit_ast::RustdocVisitor;
|
||||
use clean;
|
||||
|
|
@ -127,7 +128,8 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
cfgs: Vec<String>,
|
||||
externs: config::Externs,
|
||||
input: Input,
|
||||
triple: Option<String>) -> (clean::Crate, RenderInfo)
|
||||
triple: Option<String>,
|
||||
maybe_sysroot: Option<PathBuf>) -> (clean::Crate, RenderInfo)
|
||||
{
|
||||
// Parse, resolve, and typecheck the given crate.
|
||||
|
||||
|
|
@ -139,7 +141,7 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
let warning_lint = lint::builtin::WARNINGS.name_lower();
|
||||
|
||||
let sessopts = config::Options {
|
||||
maybe_sysroot: None,
|
||||
maybe_sysroot: maybe_sysroot,
|
||||
search_paths: search_paths,
|
||||
crate_types: vec!(config::CrateTypeRlib),
|
||||
lint_opts: vec!((warning_lint, lint::Allow)),
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ pub fn opts() -> Vec<RustcOptGroup> {
|
|||
own theme", "PATH")),
|
||||
unstable(optmulti("Z", "",
|
||||
"internal and debugging options (only on nightly build)", "FLAG")),
|
||||
stable(optopt("", "sysroot", "Override the system root", "PATH")),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -370,6 +371,7 @@ fn rust_input(cratefile: &str, externs: Externs, matches: &getopts::Matches) ->
|
|||
}
|
||||
let cfgs = matches.opt_strs("cfg");
|
||||
let triple = matches.opt_str("target");
|
||||
let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from);
|
||||
|
||||
let cr = PathBuf::from(cratefile);
|
||||
info!("starting to run rustc");
|
||||
|
|
@ -379,7 +381,7 @@ fn rust_input(cratefile: &str, externs: Externs, matches: &getopts::Matches) ->
|
|||
use rustc::session::config::Input;
|
||||
|
||||
tx.send(core::run_core(paths, cfgs, externs, Input::File(cr),
|
||||
triple)).unwrap();
|
||||
triple, maybe_sysroot)).unwrap();
|
||||
});
|
||||
let (mut krate, renderinfo) = rx.recv().unwrap();
|
||||
info!("finished with rustc");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue