Skip to content

Commit 44cd71b

Browse files
committed
Update MSRV to 1.78-nightly
1 parent d717e59 commit 44cd71b

34 files changed

+42
-27
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ version = "0.1.0"
1313
authors = ["Juniper Tyree <[email protected]>"]
1414
license = "MIT OR Apache-2.0"
1515
edition = "2021"
16-
rust-version = "1.75" # nightly
16+
rust-version = "1.78" # nightly
1717

1818
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1919

@@ -29,7 +29,7 @@ rustacuda_core = "0.1.2"
2929
rustacuda = { version = "0.1.3", optional = true }
3030
rustacuda_derive = { version = "0.1.2", optional = true }
3131

32-
const-type-layout = { version = "0.2.0", features = ["derive"] }
32+
const-type-layout = { version = "0.3.0", features = ["derive"] }
3333

3434
final = "0.1.1"
3535
hashbrown = { version = "0.14", default-features = false, features = ["inline-more"], optional = true }

examples/derive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ edition = "2021"
88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
99

1010
[dependencies]
11-
const-type-layout = { version = "0.2.0" }
11+
const-type-layout = { version = "0.3.0" }
1212
rust-cuda = { path = "../../", features = ["derive", "host"] }

examples/derive/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![deny(clippy::pedantic)]
22
#![feature(const_type_name)]
3-
#![feature(offset_of)]
43

54
#[derive(rust_cuda::common::LendRustToCuda)]
65
struct Inner<T: Copy> {

examples/single-source/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2021"
88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
99

1010
[dependencies]
11-
const-type-layout = { version = "0.2.0" }
11+
const-type-layout = { version = "0.3.0" }
1212

1313
[target.'cfg(target_os = "cuda")'.dependencies]
1414
rust-cuda = { path = "../../", features = ["derive"] }

examples/single-source/src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#![cfg_attr(target_os = "cuda", no_main)]
44
#![cfg_attr(target_os = "cuda", feature(abi_ptx))]
55
#![cfg_attr(target_os = "cuda", feature(alloc_error_handler))]
6-
#![cfg_attr(target_os = "cuda", feature(stdsimd))]
6+
#![cfg_attr(target_os = "cuda", feature(stdarch_nvptx))]
77
#![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))]
88
#![feature(const_type_name)]
9-
#![feature(offset_of)]
109

1110
extern crate alloc;
1211

rust-cuda-derive/src/kernel/link/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::path::PathBuf;
22

3+
use quote::quote;
4+
35
#[allow(clippy::module_name_repetitions)]
46
pub(super) struct LinkKernelConfig {
57
pub(super) kernel: syn::Ident,

rust-cuda-derive/src/kernel/link/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use ptx_builder::{
1111
builder::{BuildStatus, Builder, MessageFormat, Profile},
1212
error::{BuildErrorKind, Error, Result},
1313
};
14+
use quote::quote;
1415

1516
use super::utils::skip_kernel_compilation;
1617

@@ -287,7 +288,7 @@ fn build_kernel_with_specialisation(
287288
let any_output = AtomicBool::new(false);
288289
let crate_name = String::from(builder.get_crate_name());
289290

290-
match builder.build_live(
291+
let status = builder.build_live(
291292
|stdout_line| {
292293
if let Ok(cargo_metadata::Message::CompilerMessage(mut message)) =
293294
serde_json::from_str(stdout_line)
@@ -355,7 +356,9 @@ fn build_kernel_with_specialisation(
355356
);
356357
colored::control::unset_override();
357358
},
358-
)? {
359+
)?;
360+
361+
match status {
359362
BuildStatus::Success(output) => {
360363
let ptx_path = output.get_assembly_path();
361364

rust-cuda-derive/src/kernel/specialise/call.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro::TokenStream;
2+
use quote::quote;
23

34
#[allow(clippy::module_name_repetitions)]
45
pub fn specialise_kernel_call(tokens: TokenStream) -> TokenStream {

rust-cuda-derive/src/kernel/specialise/entry.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::env::VarError;
22

33
use proc_macro::TokenStream;
4+
use quote::quote;
45

56
#[allow(clippy::module_name_repetitions)]
67
pub fn specialise_kernel_entry(attr: TokenStream, func: TokenStream) -> TokenStream {

rust-cuda-derive/src/kernel/wrapper/generate/args_trait.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::{DeclGenerics, FunctionInputs, ImplGenerics, KernelConfig};
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/get_ptx_str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23
use syn::spanned::Spanned;
34

45
use crate::kernel::utils::skip_kernel_compilation;

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/kernel_func.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::super::{DeclGenerics, FuncIdent, FunctionInputs, InputCudaType, KernelConfig};
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/kernel_func_raw/launch_types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23
use syn::spanned::Spanned;
34

45
use crate::kernel::utils::r2c_move_lifetime;

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/kernel_func_raw/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::super::{DeclGenerics, FuncIdent, FunctionInputs, KernelConfig};
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/kernel_func_raw/raw_func_types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23
use syn::spanned::Spanned;
34

45
use crate::kernel::utils::r2c_move_lifetime;

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/kernel_func_raw/type_wrap.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use crate::kernel::wrapper::InputCudaType;
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::{DeclGenerics, FuncIdent, FunctionInputs, KernelConfig};
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_linker_macro/new_kernel.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::super::{DeclGenerics, FuncIdent, KernelConfig};
45

rust-cuda-derive/src/kernel/wrapper/generate/cpu_wrapper.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use crate::kernel::utils::r2c_move_lifetime;
45

rust-cuda-derive/src/kernel/wrapper/generate/cuda_generic_function.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use proc_macro2::TokenStream;
2+
use quote::quote;
23

34
use super::super::{DeclGenerics, FuncIdent};
45

rust-cuda-derive/src/kernel/wrapper/generate/cuda_wrapper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use proc_macro2::TokenStream;
2-
use quote::quote_spanned;
2+
use quote::{quote, quote_spanned};
33
use syn::spanned::Spanned;
44

55
use super::super::{FuncIdent, FunctionInputs, InputCudaType, KernelConfig};

rust-cuda-derive/src/kernel/wrapper/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use generate::{
1616
use inputs::{parse_function_inputs, FunctionInputs};
1717
use parse::parse_kernel_fn;
1818
use proc_macro2::Span;
19+
use quote::quote;
1920
use syn::spanned::Spanned;
2021

2122
#[allow(clippy::too_many_lines)]

rust-cuda-ptx-jit/src/host/kernel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl CudaKernel {
1717
pub fn new(ptx: &CStr, entry_point: &CStr) -> CudaResult<Self> {
1818
let module = Box::new(Module::load_from_string(ptx)?);
1919

20-
let function = unsafe { &*(module.as_ref() as *const Module) }.get_function(entry_point);
20+
let function = unsafe { &*std::ptr::from_ref(module.as_ref()) }.get_function(entry_point);
2121

2222
let function = match function {
2323
Ok(function) => function,

rust-toolchain

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
# Pin version pin until const traits are back
3-
channel = "nightly-2023-11-10"
2+
# Pin to final 1.78.0 nightly
3+
channel = "nightly-2024-03-17"
44
components = [ "cargo", "rustfmt", "clippy" ]
55
targets = [ "x86_64-unknown-linux-gnu", "nvptx64-nvidia-cuda" ]

src/common.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#[cfg(any(not(feature = "host"), doc))]
2-
use core::convert::{AsMut, AsRef};
31
use core::marker::PhantomData;
42

53
#[cfg(feature = "host")]

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
#![feature(negative_impls)]
77
#![cfg_attr(
88
any(all(not(feature = "host"), target_os = "cuda"), doc),
9-
feature(stdsimd)
9+
feature(stdarch_nvptx)
1010
)]
1111
#![cfg_attr(any(feature = "alloc", doc), feature(allocator_api))]
1212
#![feature(doc_cfg)]
1313
#![feature(marker_trait_attr)]
1414
#![feature(const_type_name)]
15-
#![feature(offset_of)]
1615
#![feature(adt_const_params)]
1716
#![allow(incomplete_features)]
1817
#![feature(generic_const_exprs)]

src/utils/aliasing/const.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use core::{
22
borrow::{Borrow, BorrowMut},
3-
convert::{AsMut, AsRef},
43
ops::{Deref, DerefMut},
54
};
65

src/utils/aliasing/dynamic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use core::{
22
borrow::{Borrow, BorrowMut},
3-
convert::{AsMut, AsRef},
43
ops::{Deref, DerefMut},
54
};
65

src/utils/aliasing/final.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ unsafe impl<T: RustToCuda> RustToCuda for Final<T> {
4242
alloc: crate::host::CombinedCudaAlloc<Self::CudaAllocation, A>,
4343
) -> rustacuda::error::CudaResult<A> {
4444
// Safety: Final is a repr(transparent) newtype wrapper around T
45-
let inner: &mut T = &mut *(self as *mut Self).cast();
45+
let inner: &mut T = &mut *core::ptr::from_mut(self).cast();
4646

4747
inner.restore(alloc)
4848
}

src/utils/box.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(unused_imports)] // std prelude is not always imported
12
use alloc::boxed::Box;
23

34
use const_type_layout::TypeGraphLayout;

src/utils/boxed_slice.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(unused_imports)] // std prelude is not always imported
12
use alloc::boxed::Box;
23

34
use const_type_layout::TypeGraphLayout;

src/utils/device_copy.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ impl<T: SafeDeviceCopy + TypeGraphLayout> SafeDeviceCopyWrapper<T> {
3131

3232
pub fn from_ref(reference: &T) -> &Self {
3333
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype around `T`
34-
unsafe { &*(reference as *const T).cast() }
34+
unsafe { &*core::ptr::from_ref(reference).cast() }
3535
}
3636

3737
pub fn into_ref(&self) -> &T {
3838
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype around `T`
39-
unsafe { &*(self as *const Self).cast() }
39+
unsafe { &*core::ptr::from_ref(self).cast() }
4040
}
4141

4242
pub fn from_mut(reference: &mut T) -> &mut Self {
4343
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype around `T`
44-
unsafe { &mut *(reference as *mut T).cast() }
44+
unsafe { &mut *core::ptr::from_mut(reference).cast() }
4545
}
4646

4747
pub fn into_mut(&mut self) -> &mut T {
4848
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype around `T`
49-
unsafe { &mut *(self as *mut Self).cast() }
49+
unsafe { &mut *core::ptr::from_mut(self).cast() }
5050
}
5151

5252
pub fn from_slice(slice: &[T]) -> &[Self] {

src/utils/exchange/buffer/host.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(unused_imports)] // std prelude is not always imported
12
use alloc::vec::Vec;
23
use core::{
34
cell::UnsafeCell,
@@ -42,7 +43,7 @@ impl<T: Clone + SafeDeviceCopy + TypeGraphLayout, const M2D: bool, const M2H: bo
4243
/// Returns a `rustacuda::errors::CudaError` iff an error occurs inside CUDA
4344
pub fn new(elem: &T, capacity: usize) -> CudaResult<Self> {
4445
// Safety: CudaExchangeItem is a `repr(transparent)` wrapper around T
45-
let elem: &CudaExchangeItem<T, M2D, M2H> = unsafe { &*(elem as *const T).cast() };
46+
let elem: &CudaExchangeItem<T, M2D, M2H> = unsafe { &*core::ptr::from_ref(elem).cast() };
4647

4748
let host_buffer = CudaDropWrapper::from(LockedBuffer::new(elem, capacity)?);
4849
let device_buffer = UnsafeCell::new(CudaDropWrapper::from(DeviceBuffer::from_slice(

src/utils/option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ impl<T: SafeDeviceCopy + TypeGraphLayout> RustToCudaProxy<Option<T>>
102102
{
103103
fn from_ref(val: &Option<T>) -> &Self {
104104
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype
105-
unsafe { &*(val as *const Option<T>).cast() }
105+
unsafe { &*core::ptr::from_ref(val).cast() }
106106
}
107107

108108
fn from_mut(val: &mut Option<T>) -> &mut Self {
109109
// Safety: `SafeDeviceCopyWrapper` is a transparent newtype
110-
unsafe { &mut *(val as *mut Option<T>).cast() }
110+
unsafe { &mut *core::ptr::from_mut(val).cast() }
111111
}
112112

113113
fn into(self) -> Option<T> {

0 commit comments

Comments
 (0)