Skip to content

Commit 5943507

Browse files
author
Jorge Aparicio
committed
fix built-in target detection
previously the logic was accepting wrong triples (like `x86_64_unknown-linux-musl`) as valid ones (like `x86_64-unknown-linux-musl`) if they contained an underscore instead of a dash. fixes rust-lang#33329
1 parent d80497e commit 5943507

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ macro_rules! supported_targets {
7171

7272
// this would use a match if stringify! were allowed in pattern position
7373
fn load_specific(target: &str) -> Option<Target> {
74-
let target = target.replace("-", "_");
7574
if false { }
7675
$(
77-
else if target == stringify!($module) {
76+
else if target == $triple {
7877
let mut t = $module::target();
7978
t.options.is_builtin = true;
8079
debug!("Got builtin target: {:?}", t);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
all:
2+
$(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | \
3+
grep "error: Error loading target specification: Could not find specification for target"

src/test/run-make/issue-33329/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {}

0 commit comments

Comments
 (0)