Skip to content

Update Rust toolchain to nightly-2025-06-23 #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025
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
15 changes: 5 additions & 10 deletions crates/cuda_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl fmt::Display for CudaBuilderError {
}
CudaBuilderError::BuildFailed => f.write_str("Build failed"),
CudaBuilderError::FailedToCopyPtxFile(err) => {
f.write_str(&format!("Failed to copy PTX file: {:?}", err))
f.write_str(&format!("Failed to copy PTX file: {err:?}"))
}
}
}
Expand Down Expand Up @@ -369,19 +369,14 @@ fn find_rustc_codegen_nvvm() -> PathBuf {
return path;
}
}
panic!("Could not find {} in library path", filename);
panic!("Could not find {filename} in library path");
}

/// Joins strings together while ensuring none of the strings contain the separator.
fn join_checking_for_separators(strings: Vec<impl Borrow<str>>, sep: &str) -> String {
for s in &strings {
let s = s.borrow();
assert!(
!s.contains(sep),
"{:?} may not contain separator {:?}",
s,
sep
);
assert!(!s.contains(sep), "{s:?} may not contain separator {sep:?}");
}
strings.join(sep)
}
Expand All @@ -404,7 +399,7 @@ fn invoke_rustc(builder: &CudaBuilder) -> Result<PathBuf, CudaBuilderError> {
EmitOption::LlvmIr => "llvm-ir",
EmitOption::Bitcode => "llvm-bc",
};
rustflags.push(format!("--emit={}", string));
rustflags.push(format!("--emit={string}"));
}

let mut llvm_args = vec![NvvmOption::Arch(builder.arch).to_string()];
Expand Down Expand Up @@ -533,7 +528,7 @@ fn get_last_artifact(out: &str) -> Option<PathBuf> {
Ok(line) => Some(line),
Err(_) => {
// Pass through invalid lines
println!("{}", line);
println!("{line}");
None
}
})
Expand Down
2 changes: 1 addition & 1 deletion crates/cuda_std/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ macro_rules! inbounds {
}};
($func_name:ident, $lower_bound:expr, $upper_bound:expr) => {{
let val = unsafe { $func_name() };
if val < $lower_bound || val > $upper_bound {
if !($lower_bound..=$upper_bound).contains(&val) {
// SAFETY: this condition is declared unreachable by compute capability max bound
// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#compute-capabilities
// we do this to potentially allow for better optimizations by LLVM
Expand Down
2 changes: 1 addition & 1 deletion crates/cust/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl fmt::Display for CudaError {
.to_result()
.map_err(|_| fmt::Error)?;
let cstr = CStr::from_ptr(ptr);
write!(f, "{:?}", cstr)
write!(f, "{cstr:?}")
}
}
// This shouldn't happen
Expand Down
2 changes: 1 addition & 1 deletion crates/cust/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ unsafe impl Send for Function<'_> {}
unsafe impl Sync for Function<'_> {}

impl Function<'_> {
pub(crate) fn new(inner: CUfunction, _module: &Module) -> Function {
pub(crate) fn new(inner: CUfunction, _module: &Module) -> Function<'_> {
Function {
inner,
module: PhantomData,
Expand Down
2 changes: 1 addition & 1 deletion crates/cust/src/memory/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl ArrayFormat {
// there are literally no docs on what nv12 is???
// it seems to be something with multiplanar arrays, needs some investigation
CUarray_format_enum::CU_AD_FORMAT_NV12 => panic!("nv12 is not supported yet"),
_ => panic!("Unsupported array format: {:?}", raw),
_ => panic!("Unsupported array format: {raw:?}"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cust/src/memory/device/device_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<T: DeviceCopy + Zeroable> DeviceBuffer<T> {

#[cfg(feature = "bytemuck")]
fn casting_went_wrong(src: &str, err: PodCastError) -> ! {
panic!("{}>{:?}", src, err);
panic!("{src}>{err:?}");
}

#[cfg(feature = "bytemuck")]
Expand Down
12 changes: 3 additions & 9 deletions crates/cust/src/memory/device/device_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,27 +445,21 @@ pub trait DeviceSliceIndex<T: DeviceCopy> {
#[cold]
#[track_caller]
fn slice_start_index_len_fail(index: usize, len: usize) -> ! {
panic!(
"range start index {} out of range for slice of length {}",
index, len
);
panic!("range start index {index} out of range for slice of length {len}");
}

#[inline(never)]
#[cold]
#[track_caller]
fn slice_end_index_len_fail(index: usize, len: usize) -> ! {
panic!(
"range end index {} out of range for slice of length {}",
index, len
);
panic!("range end index {index} out of range for slice of length {len}");
}

#[inline(never)]
#[cold]
#[track_caller]
fn slice_index_order_fail(index: usize, end: usize) -> ! {
panic!("slice index starts at {} but ends at {}", index, end);
panic!("slice index starts at {index} but ends at {end}");
}

#[inline(never)]
Expand Down
7 changes: 2 additions & 5 deletions crates/cust_raw/build/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ impl ParseCallbacks for BindgenCallbacks {
match doxygen_bindgen::transform(&cleaned) {
Ok(res) => Some(res),
Err(err) => {
println!(
"cargo:warning=Problem processing doxygen comment: {}\n{}",
comment, err
);
println!("cargo:warning=Problem processing doxygen comment: {comment}\n{err}");
None
}
}
Expand Down Expand Up @@ -184,7 +181,7 @@ impl FunctionRenames {

let expanded = match build.try_expand() {
Ok(expanded) => expanded,
Err(e) => panic!("Failed to expand macros: {}", e),
Err(e) => panic!("Failed to expand macros: {e}"),
};
let expanded = str::from_utf8(&expanded).unwrap();

Expand Down
6 changes: 3 additions & 3 deletions crates/cust_raw/build/cuda_sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl CudaSdk {
cuda_root: &path::Path,
) -> Result<Vec<path::PathBuf>, Box<dyn error::Error>> {
let (target, triple) = Self::parse_target_triple()?;
assert!(triple.len() >= 3, "Invalid target triple: {:?}", triple);
assert!(triple.len() >= 3, "Invalid target triple: {triple:?}");

let search_dirs = match [triple[0].as_str(), triple[1].as_str(), triple[2].as_str()] {
["x86_64", "pc", "windows"] => {
Expand Down Expand Up @@ -248,7 +248,7 @@ impl CudaSdk {
.ok_or("Cannot find CUDA_VERSION from CUDA header file.")?;
let version = version
.parse::<u32>()
.map_err(|_| format!("Cannot parse CUDA_VERSION as u32: '{}'", version))?;
.map_err(|_| format!("Cannot parse CUDA_VERSION as u32: '{version}'"))?;
Ok(version)
}

Expand All @@ -264,7 +264,7 @@ impl CudaSdk {
.ok_or("Cannot find CUDART_VERSION from cuda_runtime header file.")?;
let version = version
.parse::<u32>()
.map_err(|_| format!("Cannot parse CUDART_VERSION as u32: '{}'", version))?;
.map_err(|_| format!("Cannot parse CUDART_VERSION as u32: '{version}'"))?;
Ok(version)
}

Expand Down
12 changes: 9 additions & 3 deletions crates/cust_raw/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ fn main() {
let metadata_nvvm_include = env::join_paths(sdk.nvvm_include_paths())
.map(|s| s.to_string_lossy().to_string())
.expect("Failed to build metadata for nvvm_include.");
println!("cargo::metadata=includes={}", metadata_cuda_include);
println!("cargo::metadata=nvvm_includes={}", metadata_nvvm_include);
println!("cargo::metadata=includes={metadata_cuda_include}");
println!("cargo::metadata=nvvm_includes={metadata_nvvm_include}");
// Re-run build script conditions.
println!("cargo::rerun-if-changed=build");
for e in sdk.related_cuda_envs() {
println!("cargo::rerun-if-env-changed={}", e);
println!("cargo::rerun-if-env-changed={e}");
}

create_cuda_driver_bindings(&sdk, &outdir, &manifest_dir);
Expand Down Expand Up @@ -138,6 +138,12 @@ fn create_cuda_driver_bindings(
.allowlist_type("^cuda.*")
.allowlist_var("^CU.*")
.allowlist_function("^cu.*")
.no_partialeq("CUDA_HOST_NODE_PARAMS.*")
.no_partialeq("CUDA_KERNEL_NODE_PARAMS.*")
.no_hash("CUDA_HOST_NODE_PARAMS.*")
.no_hash("CUDA_KERNEL_NODE_PARAMS.*")
.no_copy("CUDA_HOST_NODE_PARAMS.*")
.no_copy("CUDA_KERNEL_NODE_PARAMS.*")
.default_enum_style(bindgen::EnumVariation::Rust {
non_exhaustive: false,
})
Expand Down
7 changes: 7 additions & 0 deletions crates/cust_raw/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#[cfg(feature = "driver")]
#[allow(clippy::missing_safety_doc)]
pub mod driver_sys;
#[cfg(feature = "runtime")]
#[allow(clippy::missing_safety_doc)]
pub mod runtime_sys;

#[cfg(feature = "cublas")]
#[allow(clippy::missing_safety_doc)]
pub mod cublas_sys;
#[cfg(feature = "cublaslt")]
#[allow(clippy::missing_safety_doc)]
pub mod cublaslt_sys;
#[cfg(feature = "cublasxt")]
#[allow(clippy::missing_safety_doc)]
pub mod cublasxt_sys;

#[cfg(feature = "nvptx-compiler")]
#[allow(clippy::missing_safety_doc)]
pub mod nvptx_compiler_sys;
#[cfg(feature = "nvvm")]
#[allow(clippy::missing_safety_doc)]
pub mod nvvm_sys;
2 changes: 1 addition & 1 deletion crates/gpu_rand/src/xoroshiro/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub struct Seed512(pub [u8; 64]);

impl Seed512 {
/// Return an iterator over the seed.
pub fn iter(&self) -> core::slice::Iter<u8> {
pub fn iter(&self) -> core::slice::Iter<'_, u8> {
self.0.iter()
}
}
Expand Down
9 changes: 3 additions & 6 deletions crates/nvvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl Display for NvvmOption {
Self::GenDebugInfo => "-g",
Self::GenLineInfo => "-generate-line-info",
Self::NoOpts => "-opt=0",
Self::Arch(arch) => return f.write_str(&format!("-arch={}", arch)),
Self::Arch(arch) => return f.write_str(&format!("-arch={arch}")),
Self::Ftz => "-ftz=1",
Self::FastSqrt => "-prec-sqrt=0",
Self::FastDiv => "-prec-div=0",
Expand Down Expand Up @@ -283,7 +283,7 @@ pub enum NvvmArch {

impl Display for NvvmArch {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut raw = format!("{:?}", self).to_ascii_lowercase();
let mut raw = format!("{self:?}").to_ascii_lowercase();
raw.insert(7, '_');
f.write_str(&raw)
}
Expand Down Expand Up @@ -325,10 +325,7 @@ impl NvvmProgram {
///
pub fn compile(&self, options: &[NvvmOption]) -> Result<Vec<u8>, NvvmError> {
unsafe {
let options = options
.iter()
.map(|x| format!("{}\0", x))
.collect::<Vec<_>>();
let options = options.iter().map(|x| format!("{x}\0")).collect::<Vec<_>>();
let mut options_ptr = options
.iter()
.map(|x| x.as_ptr().cast())
Expand Down
15 changes: 7 additions & 8 deletions crates/ptx/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<'src> Lexer<'src> {
}
c => {
self.next();
return Some(Err(format!("Unexpected token `{}`", c)));
return Some(Err(format!("Unexpected token `{c}`")));
}
}))
}
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<'src> Lexer<'src> {
let val = string
.as_str()
.parse::<f64>()
.map_err(|_| format!("Failed to parse `{}` as f64 literal", string))?;
.map_err(|_| format!("Failed to parse `{string}` as f64 literal"))?;

*self.values.last_mut().unwrap() = Some(TokenValue::Double(val));
return Ok(Token {
Expand All @@ -315,7 +315,7 @@ impl<'src> Lexer<'src> {
let val = string
.as_str()
.parse::<f64>()
.map_err(|_| format!("Failed to parse `{}` as f64 literal", string))?;
.map_err(|_| format!("Failed to parse `{string}` as f64 literal"))?;

*self.values.last_mut().unwrap() = Some(TokenValue::Double(val));
return Ok(Token {
Expand All @@ -338,7 +338,7 @@ impl<'src> Lexer<'src> {
let val = string
.as_str()
.parse::<f64>()
.map_err(|_| format!("Failed to parse `{}` as f64 literal", string))?;
.map_err(|_| format!("Failed to parse `{string}` as f64 literal"))?;

*self.values.last_mut().unwrap() = Some(TokenValue::Double(val));
return Ok(Token {
Expand Down Expand Up @@ -369,7 +369,7 @@ impl<'src> Lexer<'src> {
}

let raw = u32::from_str_radix(numbers.as_str(), 16).map_err(|_| {
format!("Failed to parse `{}` as a 32 bit hex integer", numbers)
format!("Failed to parse `{numbers}` as a 32 bit hex integer")
})?;

*self.values.last_mut().unwrap() = Some(TokenValue::Float(f32::from_bits(raw)));
Expand All @@ -390,7 +390,7 @@ impl<'src> Lexer<'src> {
}

let raw = u64::from_str_radix(numbers.as_str(), 16).map_err(|_| {
format!("Failed to parse `{}` as a 64 bit hex integer", numbers)
format!("Failed to parse `{numbers}` as a 64 bit hex integer")
})?;

*self.values.last_mut().unwrap() =
Expand Down Expand Up @@ -557,8 +557,7 @@ impl<'src> Lexer<'src> {
}

Err(format!(
"Expected directive or reserved type, but found `.{}` instead",
ident
"Expected directive or reserved type, but found `.{ident}` instead"
))
}
}
Loading
Loading