From 12b89cdc2c30eeab8d0ec679290bd23ba2706731 Mon Sep 17 00:00:00 2001 From: Brandon Ros Date: Sun, 3 May 2026 13:49:39 -0400 Subject: [PATCH 1/3] fix(cust_raw): qualify str::from_utf8 to avoid nightly-only inherent --- crates/cust_raw/build/callbacks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cust_raw/build/callbacks.rs b/crates/cust_raw/build/callbacks.rs index 8a00f7fe..97080f16 100644 --- a/crates/cust_raw/build/callbacks.rs +++ b/crates/cust_raw/build/callbacks.rs @@ -170,7 +170,7 @@ impl FunctionRenames { Ok(expanded) => expanded, Err(e) => panic!("Failed to expand macros: {e}"), }; - let expanded = str::from_utf8(&expanded).unwrap(); + let expanded = std::str::from_utf8(&expanded).unwrap(); let mut remaps = bimap::BiHashMap::new(); for line in expanded.lines().rev() { From c417c1df32511281a7f1c322de849cca41d66a29 Mon Sep 17 00:00:00 2001 From: Brandon Ros Date: Sun, 3 May 2026 13:51:15 -0400 Subject: [PATCH 2/3] fix(cust): avoid unstable is_multiple_of in DeviceBuffer::try_cast --- crates/cust/src/memory/device/device_buffer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cust/src/memory/device/device_buffer.rs b/crates/cust/src/memory/device/device_buffer.rs index 80a80e01..06c0052f 100644 --- a/crates/cust/src/memory/device/device_buffer.rs +++ b/crates/cust/src/memory/device/device_buffer.rs @@ -323,7 +323,7 @@ impl DeviceBuffer { #[cfg_attr(docsrs, doc(cfg(feature = "bytemuck")))] pub fn try_cast(self) -> Result, PodCastError> { if align_of::() > align_of::() - && !(self.buf.as_raw() as usize).is_multiple_of(align_of::()) + && (self.buf.as_raw() as usize) % align_of::() != 0 { Err(PodCastError::TargetAlignmentGreaterAndInputNotAligned) } else if size_of::() == size_of::() { @@ -331,7 +331,7 @@ impl DeviceBuffer { Ok(unsafe { transmute::, DeviceBuffer>(self) }) } else if size_of::() == 0 || size_of::() == 0 { Err(PodCastError::SizeMismatch) - } else if (size_of::() * self.len).is_multiple_of(size_of::()) { + } else if (size_of::() * self.len) % size_of::() == 0 { let new_len = (size_of::() * self.len) / size_of::(); let ret = Ok(DeviceBuffer { buf: self.buf.cast(), From 38212ab745b6d257992e37bc0bc2b7b659bebed4 Mon Sep 17 00:00:00 2001 From: Brandon Ros Date: Sun, 3 May 2026 14:21:31 -0400 Subject: [PATCH 3/3] fix: avoid let-chains in stable-buildable crates --- crates/cuda_builder/src/lib.rs | 22 ++++++++++++---------- crates/ptx/src/lexer.rs | 16 ++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/crates/cuda_builder/src/lib.rs b/crates/cuda_builder/src/lib.rs index 8e8bf2b1..7095dbc6 100644 --- a/crates/cuda_builder/src/lib.rs +++ b/crates/cuda_builder/src/lib.rs @@ -469,11 +469,12 @@ fn find_in_dir(dir: &Path, filename: &str) -> Option { continue; } - if let Some(name) = path.file_name().and_then(|s| s.to_str()) - && (name == filename - || (name.starts_with(&hashed_prefix) && name.ends_with(dll_suffix))) - { - return Some(path); + if let Some(name) = path.file_name().and_then(|s| s.to_str()) { + if name == filename + || (name.starts_with(&hashed_prefix) && name.ends_with(dll_suffix)) + { + return Some(path); + } } } } @@ -586,11 +587,12 @@ fn workspace_root_dir() -> Option { loop { let candidate = path.join("Cargo.toml"); - if candidate.is_file() - && let Ok(contents) = fs::read_to_string(&candidate) - && contents.contains("[workspace]") - { - return Some(path.clone()); + if candidate.is_file() { + if let Ok(contents) = fs::read_to_string(&candidate) { + if contents.contains("[workspace]") { + return Some(path.clone()); + } + } } if !path.pop() { diff --git a/crates/ptx/src/lexer.rs b/crates/ptx/src/lexer.rs index 354c1c26..9cd23d49 100644 --- a/crates/ptx/src/lexer.rs +++ b/crates/ptx/src/lexer.rs @@ -440,14 +440,14 @@ impl<'src> Lexer<'src> { let cur = self.cur; let ident = self.eat_until(|c, _| is_ident_continue(c)); // check if its an instruction - if ident.chars().all(|c| c.is_ascii_alphanumeric()) - && let Ok(kind) = InstructionKind::from_str(ident.as_str()) - { - *self.values.last_mut().unwrap() = Some(TokenValue::Instruction(kind)); - return Token { - kind: TokenKind::Instruction, - range: cur..self.cur, - }; + if ident.chars().all(|c| c.is_ascii_alphanumeric()) { + if let Ok(kind) = InstructionKind::from_str(ident.as_str()) { + *self.values.last_mut().unwrap() = Some(TokenValue::Instruction(kind)); + return Token { + kind: TokenKind::Instruction, + range: cur..self.cur, + }; + } } *self.values.last_mut().unwrap() =