Skip to content

Commit 859815b

Browse files
committed
Move Target::llvm_target to MaybeLazy
1 parent 723e040 commit 859815b

22 files changed

+23
-23
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ impl TargetWarnings {
18821882
#[derive(PartialEq, Clone, Debug)]
18831883
pub struct Target {
18841884
/// Target triple to pass to LLVM.
1885-
pub llvm_target: StaticCow<str>,
1885+
pub llvm_target: MaybeLazy<str>,
18861886
/// Metadata about a target, for example the description or tier.
18871887
/// Used for generating target documentation.
18881888
pub metadata: TargetMetadata,
@@ -2734,7 +2734,7 @@ impl Target {
27342734
};
27352735

27362736
let mut base = Target {
2737-
llvm_target: get_req_field("llvm-target")?.into(),
2737+
llvm_target: MaybeLazy::owned(get_req_field("llvm-target")?),
27382738
metadata: Default::default(),
27392739
pointer_width: get_req_field("target-pointer-width")?
27402740
.parse::<u32>()

compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn target() -> Target {
1717
// Clang automatically chooses a more specific target based on
1818
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
1919
// correctly, we do too.
20-
llvm_target: macos_llvm_target(ARCH).into(),
20+
llvm_target: MaybeLazy::lazy(|| macos_llvm_target(ARCH)),
2121
metadata: crate::spec::TargetMetadata {
2222
description: None,
2323
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn target() -> Target {
1414
// IPHONEOS_DEPLOYMENT_TARGET.
1515
// This is required for the target to pick the right
1616
// MACH-O commands, so we do too.
17-
llvm_target: ios_llvm_target(ARCH).into(),
17+
llvm_target: MaybeLazy::lazy(|| ios_llvm_target(ARCH)),
1818
metadata: crate::spec::TargetMetadata {
1919
description: None,
2020
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
1111

1212
Target {
13-
llvm_target: mac_catalyst_llvm_target(ARCH).into(),
13+
llvm_target: MaybeLazy::lazy(|| mac_catalyst_llvm_target(ARCH)),
1414
metadata: crate::spec::TargetMetadata {
1515
description: None,
1616
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn target() -> Target {
1414
// IPHONEOS_DEPLOYMENT_TARGET.
1515
// This is required for the simulator target to pick the right
1616
// MACH-O commands, so we do too.
17-
llvm_target: ios_sim_llvm_target(ARCH).into(),
17+
llvm_target: MaybeLazy::lazy(|| ios_sim_llvm_target(ARCH)),
1818
metadata: crate::spec::TargetMetadata {
1919
description: None,
2020
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn target() -> Target {
77
const ABI: TargetAbi = TargetAbi::Normal;
88

99
Target {
10-
llvm_target: tvos_llvm_target(ARCH).into(),
10+
llvm_target: MaybeLazy::lazy(|| tvos_llvm_target(ARCH)),
1111
metadata: crate::spec::TargetMetadata {
1212
description: None,
1313
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn target() -> Target {
77
const ABI: TargetAbi = TargetAbi::Normal;
88

99
Target {
10-
llvm_target: tvos_sim_llvm_target(ARCH).into(),
10+
llvm_target: MaybeLazy::lazy(|| tvos_sim_llvm_target(ARCH)),
1111
metadata: crate::spec::TargetMetadata {
1212
description: None,
1313
tier: None,

compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
1212

1313
Target {
14-
llvm_target: visionos_llvm_target(ARCH).into(),
14+
llvm_target: MaybeLazy::lazy(|| visionos_llvm_target(ARCH)),
1515
metadata: crate::spec::TargetMetadata {
1616
description: Some("ARM64 Apple visionOS".into()),
1717
tier: Some(3),

compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
1111

1212
Target {
13-
llvm_target: visionos_sim_llvm_target(ARCH).into(),
13+
llvm_target: MaybeLazy::lazy(|| visionos_sim_llvm_target(ARCH)),
1414
metadata: crate::spec::TargetMetadata {
1515
description: Some("ARM64 Apple visionOS simulator".into()),
1616
tier: Some(3),

compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
// WATCHOS_DEPLOYMENT_TARGET.
1212
// This is required for the simulator target to pick the right
1313
// MACH-O commands, so we do too.
14-
llvm_target: watchos_sim_llvm_target(ARCH).into(),
14+
llvm_target: MaybeLazy::lazy(|| watchos_sim_llvm_target(ARCH)),
1515
metadata: crate::spec::TargetMetadata {
1616
description: None,
1717
tier: None,

0 commit comments

Comments
 (0)