Skip to content

Commit 1ea1159

Browse files
committed
adjust target specs for rustc 1.93.0
1 parent a79deca commit 1ea1159

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

crates/rustc_codegen_spirv-types/src/target_spec.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub enum TargetSpecVersion {
1616
/// Some later version requires them.
1717
/// Some earlier version fails with them (notably our 0.9.0 release).
1818
Rustc_1_76_0,
19+
/// rustc 1.93 requires that the value of "target-pointer-width" is no longer a string but u16
20+
Rustc_1_93_0,
1921
}
2022

2123
impl TargetSpecVersion {
@@ -39,7 +41,9 @@ impl TargetSpecVersion {
3941
/// Returns the version of the target spec required for a certain rustc version. May return `None` if the version
4042
/// is old enough to not need target specs.
4143
pub fn from_rustc_version(rustc_version: Version) -> Option<Self> {
42-
if rustc_version >= Version::new(1, 85, 0) {
44+
if rustc_version >= Version::new(1, 93, 0) {
45+
Some(Self::Rustc_1_93_0)
46+
} else if rustc_version >= Version::new(1, 85, 0) {
4347
Some(Self::Rustc_1_85_0)
4448
} else if rustc_version >= Version::new(1, 76, 0) {
4549
Some(Self::Rustc_1_76_0)
@@ -52,8 +56,12 @@ impl TargetSpecVersion {
5256
pub fn format_spec(&self, target: &SpirvTarget) -> String {
5357
let target_env = target.env();
5458
let extra = match self {
55-
TargetSpecVersion::Rustc_1_85_0 => r#""crt-static-respected": true,"#,
5659
TargetSpecVersion::Rustc_1_76_0 => r#""os": "unknown","#,
60+
_ => r#""crt-static-respected": true,"#,
61+
};
62+
let target_pointer_width = match self {
63+
TargetSpecVersion::Rustc_1_76_0 | TargetSpecVersion::Rustc_1_85_0 => "\"32\"",
64+
TargetSpecVersion::Rustc_1_93_0 => "32",
5765
};
5866
format!(
5967
r#"{{
@@ -80,7 +88,7 @@ impl TargetSpecVersion {
8088
{extra}
8189
"panic-strategy": "abort",
8290
"simd-types-indirect": false,
83-
"target-pointer-width": "32"
91+
"target-pointer-width": {target_pointer_width}
8492
}}"#
8593
)
8694
}

0 commit comments

Comments
 (0)