Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
1 change: 1 addition & 0 deletions crates/rustc_codegen_spirv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ rustc_codegen_spirv-target-specs.workspace = true

[dev-dependencies]
pretty_assertions = "1.0"
termcolor = "1.1.3"

# HACK(eddyb) can't re-introduce deps of `rustc_codegen_ssa`, for `pqp_cg_ssa`
# (see `build.rs`).
Expand Down
14 changes: 10 additions & 4 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::collections::VecDeque;
use std::error::Error;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitCode};
use std::string::ToString;
use std::{env, fs, mem};

/// Current `rust-toolchain.toml` file
Expand All @@ -19,9 +18,9 @@ use std::{env, fs, mem};
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2025-06-30"
channel = "nightly-2025-11-02"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 35f6036521777bdc0dcea1f980be4c192962a168"#;
# commit_hash = bd3ac0330018c23b111bbee176f32c377be7b319"#;

fn rustc_output(arg: &str) -> Result<String, Box<dyn Error>> {
let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
Expand Down Expand Up @@ -73,7 +72,7 @@ fn check_toolchain_version() -> Result<(), Box<dyn Error>> {
let stripped_toolchain = REQUIRED_RUST_TOOLCHAIN
.lines()
.filter(|l| !l.trim().is_empty() && !l.starts_with("# "))
.map(ToString::to_string)
.map(|l| l.to_string())
.reduce(|a, b| a + "\n" + &b)
.unwrap_or_default();

Expand Down Expand Up @@ -198,6 +197,13 @@ mod win {",
for link_path in raw_dylib::",
);
}
src = src.replace(
"
for (link_path, as_needed) in raw_dylib::",
"
#[cfg(any())]
for (link_path, as_needed) in raw_dylib::",
);
if relative_path == Path::new("src/back/metadata.rs") {
// HACK(eddyb) remove `object` dependency.
src = src.replace(
Expand Down
6 changes: 3 additions & 3 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> {
span = cx.tcx.def_span(adt.did());
}

let attrs = AggregatedSpirvAttributes::parse(cx, cx.tcx.get_attrs_unchecked(adt.did()));
let attrs = AggregatedSpirvAttributes::parse(cx, cx.tcx.get_all_attrs(adt.did()));

if let Some(intrinsic_type_attr) = attrs.intrinsic_type.map(|attr| attr.value)
&& let Ok(spirv_type) =
Expand Down Expand Up @@ -791,7 +791,7 @@ fn trans_intrinsic_type<'tcx>(
let sampled_type = match args.type_at(0).kind() {
TyKind::Int(int) => match int {
IntTy::Isize => {
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, true)
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, true)
.def(span, cx)
}
IntTy::I8 => SpirvType::Integer(8, true).def(span, cx),
Expand All @@ -802,7 +802,7 @@ fn trans_intrinsic_type<'tcx>(
},
TyKind::Uint(uint) => match uint {
UintTy::Usize => {
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, false)
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, false)
.def(span, cx)
}
UintTy::U8 => SpirvType::Integer(8, false).def(span, cx),
Expand Down
3 changes: 0 additions & 3 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub enum IntrinsicType {
pub struct SpecConstant {
pub id: u32,
pub default: Option<u32>,
pub array_count: Option<u32>,
}

// NOTE(eddyb) when adding new `#[spirv(...)]` attributes, the tests found inside
Expand Down Expand Up @@ -662,8 +661,6 @@ fn parse_spec_constant_attr(
Ok(SpecConstant {
id: id.ok_or_else(|| (arg.span(), "expected `spec_constant(id = ...)`".into()))?,
default,
// to be set later
array_count: None,
})
}

Expand Down
Loading
Loading