about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-11-03 18:31:32 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-11-03 21:06:49 +0000
commit775aad80fc4de54dbf3d029ce9aca4371ea48c09 (patch)
treed0d9b04ccbfe4b0e76e8c91247430bda68ba25f1
parent9e6d2da83dcc7fe58c0352d61d20b42f09182c63 (diff)
downloadrust-775aad80fc4de54dbf3d029ce9aca4371ea48c09.tar.gz
rust-775aad80fc4de54dbf3d029ce9aca4371ea48c09.zip
Remove is_builtin target spec field
It is unused.
-rw-r--r--compiler/rustc_target/src/spec/mod.rs13
-rw-r--r--tests/run-make/target-specs/definitely-not-builtin-target.json7
-rw-r--r--tests/run-make/target-specs/rmake.rs5
3 files changed, 1 insertions, 24 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 06408e0b210..cef11fe1c9e 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -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);
diff --git a/tests/run-make/target-specs/definitely-not-builtin-target.json b/tests/run-make/target-specs/definitely-not-builtin-target.json
deleted file mode 100644
index b36fa993d97..00000000000
--- a/tests/run-make/target-specs/definitely-not-builtin-target.json
+++ /dev/null
@@ -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"
-}
diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs
index 499c6c2079a..79c888ab340 100644
--- a/tests/run-make/target-specs/rmake.rs
+++ b/tests/run-make/target-specs/rmake.rs
@@ -54,11 +54,6 @@ fn main() {
         .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")
         .run_fail()
         .assert_stderr_contains(r#""data-layout" claims architecture is little-endian"#);