Skip to content

Commit 5556554

Browse files
authored
Auto merge of #35129 - tmiasko:suggest-print-target-list, r=nagisa
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 86-unknown-linux-gnu error: Error loading target specification: Could not find specification for target "86-unknown-linux-gnu" After changes it looks as follows: $ rustc --target 86-unknown-linux-gnu error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". Use `--print target-list` for a list of supported targets
2 parents 724f811 + 443f1ca commit 5556554

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)