Skip to content
Merged
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
5 changes: 3 additions & 2 deletions crates/cust/src/memory/device/device_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,16 @@ impl<A: DeviceCopy + Pod> DeviceBuffer<A> {
/// - If either type is a ZST (but not both).
#[cfg_attr(docsrs, doc(cfg(feature = "bytemuck")))]
pub fn try_cast<B: Pod + DeviceCopy>(self) -> Result<DeviceBuffer<B>, PodCastError> {
if align_of::<B>() > align_of::<A>() && (self.buf.as_raw() as usize) % align_of::<B>() != 0
if align_of::<B>() > align_of::<A>()
&& !(self.buf.as_raw() as usize).is_multiple_of(align_of::<B>())
{
Err(PodCastError::TargetAlignmentGreaterAndInputNotAligned)
} else if size_of::<B>() == size_of::<A>() {
// SAFETY: we made sure sizes were compatible, and DeviceBuffer is repr(C)
Ok(unsafe { transmute::<DeviceBuffer<A>, DeviceBuffer<B>>(self) })
} else if size_of::<A>() == 0 || size_of::<B>() == 0 {
Err(PodCastError::SizeMismatch)
} else if (size_of::<A>() * self.len) % size_of::<B>() == 0 {
} else if (size_of::<A>() * self.len).is_multiple_of(size_of::<B>()) {
let new_len = (size_of::<A>() * self.len) / size_of::<B>();
let ret = Ok(DeviceBuffer {
buf: self.buf.cast(),
Expand Down
7 changes: 6 additions & 1 deletion crates/rustc_codegen_nvvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ impl LlvmType for CastTarget {
"total size {:?} cannot be divided into units of zero size",
self.rest.total
);
if self.rest.total.bytes() % self.rest.unit.size.bytes() != 0 {
if !self
.rest
.total
.bytes()
.is_multiple_of(self.rest.unit.size.bytes())
{
assert_eq!(
self.rest.unit.kind,
RegKind::Integer,
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_nvvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ impl<'ll, 'tcx, 'a> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
todo!()
}

fn filter_landing_pad(&mut self, _pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) {
fn filter_landing_pad(&mut self, _pers_fn: &'ll Value) {
todo!()
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_nvvm/src/int_replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub(crate) fn get_transformed_type<'ll>(
// going from i64 down.
pub(crate) fn target_vector_width_and_count(int_width: u32) -> (u32, u32) {
for &i in WIDTH_CANDIDATES {
if int_width % i == 0 {
if int_width.is_multiple_of(i) {
return (i, int_width / i);
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-06-23"
components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt", "rust-analyzer"]
channel = "nightly-2025-06-30"
components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt", "rust-analyzer"]
Loading