Skip to content

Commit

Permalink
Remove is_builtin target spec field
Browse files Browse the repository at this point in the history
It is unused.
  • Loading branch information
bjorn3 committed Nov 3, 2024
1 parent 9e6d2da commit 775aad8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
13 changes: 1 addition & 12 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1595,11 +1595,10 @@ macro_rules! supported_targets {
pub const TARGETS: &[&str] = &[$($tuple),+];

fn load_builtin(target: &str) -> Option<Target> {
let mut t = match target {
let t = match target {
$( $tuple => targets::$module::target(), )+
_ => return None,
};
t.is_builtin = true;
debug!("got builtin target: {:?}", t);
Some(t)
}
Expand Down Expand Up @@ -2128,9 +2127,6 @@ type StaticCow<T> = Cow<'static, T>;
/// through `Deref` impls.
#[derive(PartialEq, Clone, Debug)]
pub struct TargetOptions {
/// Whether the target is built-in or loaded from a custom target specification.
pub is_builtin: bool,

/// Used as the `target_endian` `cfg` variable. Defaults to little endian.
pub endian: Endian,
/// Width of c_int type. Defaults to "32".
Expand Down Expand Up @@ -2606,7 +2602,6 @@ impl Default for TargetOptions {
/// incomplete, and if used for compilation, will certainly not work.
fn default() -> TargetOptions {
TargetOptions {
is_builtin: false,
endian: Endian::Little,
c_int_width: "32".into(),
os: "none".into(),
Expand Down Expand Up @@ -3349,7 +3344,6 @@ impl Target {
}
}

key!(is_builtin, bool);
key!(c_int_width = "target-c-int-width");
key!(c_enum_min_bits, Option<u64>); // if None, matches c_int_width
key!(os);
Expand Down Expand Up @@ -3462,10 +3456,6 @@ impl Target {
key!(entry_abi, Conv)?;
key!(supports_xray, bool);

if base.is_builtin {
// This can cause unfortunate ICEs later down the line.
return Err("may not set is_builtin for targets not built-in".into());
}
base.update_from_cli();

// Each field should have been read using `Json::remove` so any keys remaining are unused.
Expand Down Expand Up @@ -3635,7 +3625,6 @@ impl ToJson for Target {
target_val!(arch);
target_val!(data_layout);

target_option_val!(is_builtin);
target_option_val!(endian, "target-endian");
target_option_val!(c_int_width, "target-c-int-width");
target_option_val!(os);
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions tests/run-make/target-specs/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ fn main() {
.expected_file("test-platform.json")
.actual_text("test-platform-2", test_platform_2)
.run();
rustc()
.input("foo.rs")
.target("definitely-not-builtin-target")
.run_fail()
.assert_stderr_contains("may not set is_builtin");
rustc()
.input("foo.rs")
.target("endianness-mismatch")
Expand Down

0 comments on commit 775aad8

Please sign in to comment.