Remove is_builtin target spec field

It is unused.
This commit is contained in:
bjorn3 2024-11-03 18:31:32 +00:00
parent 9e6d2da83d
commit 775aad80fc
3 changed files with 1 additions and 24 deletions

View File

@ -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)
}
@ -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".
@ -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(),
@ -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);
@ -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.
@ -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);

View File

@ -1,7 +0,0 @@
{
"arch": "x86_64",
"is-builtin": true,
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"llvm-target": "x86_64-unknown-unknown-gnu",
"target-pointer-width": "64"
}

View File

@ -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")