Skip to content

Commit 443f1ca

Browse files
committed
Suggest use of --print target-list when target is not found.
If given target could not be found suggest using `--print target-list`. Previously, error has been reported as: $ rustc --target x86-unknown-linux-gnu error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu" After changes it looks as follows: rustc --target x86-unknown-linux-gnu error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu" help: Use `--print target-list` for a list of built-in targets
1 parent 2ad98a0 commit 443f1ca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc/session/config.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use syntax::parse;
3030
use syntax::parse::token::InternedString;
3131
use syntax::feature_gate::UnstableFeatures;
3232

33-
use errors::{ColorConfig, Handler};
33+
use errors::{ColorConfig, FatalError, Handler};
3434

3535
use getopts;
3636
use std::collections::HashMap;
@@ -836,7 +836,10 @@ pub fn build_target_config(opts: &Options, sp: &Handler) -> Config {
836836
let target = match Target::search(&opts.target_triple) {
837837
Ok(t) => t,
838838
Err(e) => {
839-
panic!(sp.fatal(&format!("Error loading target specification: {}", e)));
839+
sp.struct_fatal(&format!("Error loading target specification: {}", e))
840+
.help("Use `--print target-list` for a list of built-in targets")
841+
.emit();
842+
panic!(FatalError);
840843
}
841844
};
842845

0 commit comments

Comments
 (0)