Skip to content

Commit bb12b30

Browse files
nnethercoteLegNeato
authored andcommitted
Update more crates to edition 2024.
Three kinds of changes are required. - Unsafe operations within unsafe functions now need to be explicitly marked with `unsafe`. - This requires setting `.wrap_unsafe_ops` for unsafe functions generated by bindgen. - `extern "C"` blocks now need to be marked as unsafe. - `cargo fmt` formats some things slightly different in edition 2024.
1 parent 61f40ed commit bb12b30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+638
-562
lines changed

crates/blastoff/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "blastoff"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Riccardo D'Ambrosio <[email protected]>"]
66
repository = "https://github.com/Rust-GPU/rust-cuda"
77

crates/blastoff/src/context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ impl CublasContext {
320320
///
321321
/// The callback must not panic and unwind.
322322
pub unsafe fn set_logger_callback(callback: Option<unsafe extern "C" fn(*const c_char)>) {
323-
cublas_sys::cublasSetLoggerCallback(callback)
324-
.to_result()
325-
.unwrap();
323+
unsafe {
324+
cublas_sys::cublasSetLoggerCallback(callback)
325+
.to_result()
326+
.unwrap();
327+
}
326328
}
327329

328330
/// Gets the logger callback that was previously set.

crates/blastoff/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ pub trait ToResult {
3838

3939
impl ToResult for cublas_sys::cublasStatus_t {
4040
fn to_result(self) -> Result<(), CublasError> {
41-
use cust_raw::cublas_sys::cublasStatus_t::*;
4241
use CublasError::*;
42+
use cust_raw::cublas_sys::cublasStatus_t::*;
4343

4444
Err(match self {
4545
CUBLAS_STATUS_SUCCESS => return Ok(()),
@@ -58,8 +58,8 @@ impl ToResult for cublas_sys::cublasStatus_t {
5858

5959
impl CublasError {
6060
pub fn into_raw(self) -> cublas_sys::cublasStatus_t {
61-
use cust_raw::cublas_sys::cublasStatus_t::*;
6261
use CublasError::*;
62+
use cust_raw::cublas_sys::cublasStatus_t::*;
6363

6464
match self {
6565
NotInitialized => CUBLAS_STATUS_NOT_INITIALIZED,

crates/blastoff/src/level1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Scalar and Vector-based operations
22
33
use crate::{
4+
BlasDatatype, Float,
45
context::CublasContext,
56
error::{Error, ToResult},
67
raw::{ComplexLevel1, FloatLevel1, Level1},
7-
BlasDatatype, Float,
88
};
99
use cust::memory::{GpuBox, GpuBuffer};
1010
use cust::stream::Stream;

crates/blastoff/src/level3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
2+
GemmDatatype, MatrixOp,
23
context::CublasContext,
34
error::{Error, ToResult},
45
raw::GemmOps,
5-
GemmDatatype, MatrixOp,
66
};
77
use cust::memory::{GpuBox, GpuBuffer};
88
use cust::stream::Stream;

0 commit comments

Comments
 (0)