changed target from option to plain target, populated with host triple at argument parsing time if no --target arguments
This commit is contained in:
parent
3f76408841
commit
657e24c56b
3 changed files with 9 additions and 10 deletions
|
@ -9,7 +9,7 @@ use rustc::session;
|
|||
use rustc::session::config::{CrateType, parse_crate_types_from_list};
|
||||
use rustc::session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs};
|
||||
use rustc::session::config::{nightly_options, build_codegen_options, build_debugging_options,
|
||||
get_cmd_lint_options, ExternEntry};
|
||||
get_cmd_lint_options, host_triple, ExternEntry};
|
||||
use rustc::session::search_paths::SearchPath;
|
||||
use rustc_driver;
|
||||
use rustc_target::spec::TargetTriple;
|
||||
|
@ -54,7 +54,7 @@ pub struct Options {
|
|||
/// Debugging (`-Z`) options to pass to the compiler.
|
||||
pub debugging_options: DebuggingOptions,
|
||||
/// The target used to compile the crate against.
|
||||
pub target: Option<TargetTriple>,
|
||||
pub target: TargetTriple,
|
||||
/// Edition used when reading the crate. Defaults to "2015". Also used by default when
|
||||
/// compiling doctests from the crate.
|
||||
pub edition: Edition,
|
||||
|
@ -425,7 +425,9 @@ impl Options {
|
|||
}
|
||||
}
|
||||
|
||||
let target = matches.opt_str("target").map(|target| {
|
||||
let target = matches.opt_str("target").map_or(
|
||||
TargetTriple::from_triple(host_triple()),
|
||||
|target| {
|
||||
if target.ends_with(".json") {
|
||||
TargetTriple::TargetPath(PathBuf::from(target))
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,6 @@ use rustc_interface::interface;
|
|||
use rustc_driver::abort_on_err;
|
||||
use rustc_resolve as resolve;
|
||||
use rustc_metadata::cstore::CStore;
|
||||
use rustc_target::spec::TargetTriple;
|
||||
|
||||
use syntax::source_map;
|
||||
use syntax::attr;
|
||||
|
@ -313,7 +312,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||
lint_cap: Some(lint_cap.unwrap_or_else(|| lint::Forbid)),
|
||||
cg: codegen_options,
|
||||
externs,
|
||||
target_triple: target.unwrap_or(host_triple),
|
||||
target_triple: target,
|
||||
// Ensure that rustdoc works even if rustc is feature-staged
|
||||
unstable_features: UnstableFeatures::Allow,
|
||||
actually_rustdoc: true,
|
||||
|
|
|
@ -60,7 +60,6 @@ pub fn run(options: Options) -> i32 {
|
|||
edition: options.edition,
|
||||
..config::Options::default()
|
||||
};
|
||||
options.target.as_ref().map(|t| { sessopts.target_triple = t.clone() });
|
||||
let config = interface::Config {
|
||||
opts: sessopts,
|
||||
crate_cfg: config::parse_cfgspecs(options.cfgs.clone()),
|
||||
|
@ -184,7 +183,7 @@ fn run_test(
|
|||
as_test_harness: bool,
|
||||
runtool: Option<String>,
|
||||
runtool_args: Vec<String>,
|
||||
target: Option<TargetTriple>,
|
||||
target: TargetTriple,
|
||||
compile_fail: bool,
|
||||
mut error_codes: Vec<String>,
|
||||
opts: &TestOptions,
|
||||
|
@ -680,7 +679,7 @@ impl Tester for Collector {
|
|||
let runtool = self.runtool.clone();
|
||||
let runtool_args = self.runtool_args.clone();
|
||||
let target = self.target.clone();
|
||||
let target_str = target.as_ref().map(|t| t.to_string());
|
||||
let target_str = target.to_string();
|
||||
|
||||
debug!("creating test {}: {}", name, test);
|
||||
self.tests.push(testing::TestDescAndFn {
|
||||
|
@ -690,8 +689,7 @@ impl Tester for Collector {
|
|||
Ignore::All => true,
|
||||
Ignore::None => false,
|
||||
Ignore::Some(ref ignores) => {
|
||||
target_str.map_or(false,
|
||||
|s| ignores.iter().any(|t| s.contains(t)))
|
||||
ignores.iter().any(|s| target_str.contains(s))
|
||||
},
|
||||
},
|
||||
// compiler failures are test failures
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue