mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 18:03:10 -04:00
Following the kernel minimum version bump in commit f32fb9c58a ("rust:
bump Rust minimum supported version to 1.85.0 (Debian Trixie)"), bump
pin-init's minimum Rust version to 1.82.
This removes the `lint_reasons` feature which is stabilized in 1.81 and the
`raw_ref_ops` and `new_uninit` features which are stabilized in 1.82.
Given we do not use any features that are stabilized in 1.82..=1.85 range,
and pin-init crate is useful for other projects which may have their own
MSRV requirements, the minimum version is not straightly bumped to 1.85.
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-2-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo <gary@garyguo.net>
60 lines
1.9 KiB
Rust
60 lines
1.9 KiB
Rust
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
|
|
// When fixdep scans this, it will find this string `CONFIG_RUSTC_VERSION_TEXT`
|
|
// and thus add a dependency on `include/config/RUSTC_VERSION_TEXT`, which is
|
|
// touched by Kconfig when the version string from the compiler changes.
|
|
|
|
//! `pin-init` proc macros.
|
|
|
|
// Documentation is done in the pin-init crate instead.
|
|
#![allow(missing_docs)]
|
|
|
|
use proc_macro::TokenStream;
|
|
use syn::parse_macro_input;
|
|
|
|
use crate::diagnostics::DiagCtxt;
|
|
|
|
mod diagnostics;
|
|
mod init;
|
|
mod pin_data;
|
|
mod pinned_drop;
|
|
mod zeroable;
|
|
|
|
#[proc_macro_attribute]
|
|
pub fn pin_data(args: TokenStream, input: TokenStream) -> TokenStream {
|
|
let args = parse_macro_input!(args);
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| pin_data::pin_data(args, input, dcx)).into()
|
|
}
|
|
|
|
#[proc_macro_attribute]
|
|
pub fn pinned_drop(args: TokenStream, input: TokenStream) -> TokenStream {
|
|
let args = parse_macro_input!(args);
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| pinned_drop::pinned_drop(args, input, dcx)).into()
|
|
}
|
|
|
|
#[proc_macro_derive(Zeroable)]
|
|
pub fn derive_zeroable(input: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| zeroable::derive(input, dcx)).into()
|
|
}
|
|
|
|
#[proc_macro_derive(MaybeZeroable)]
|
|
pub fn maybe_derive_zeroable(input: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| zeroable::maybe_derive(input, dcx)).into()
|
|
}
|
|
#[proc_macro]
|
|
pub fn init(input: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| init::expand(input, Some("::core::convert::Infallible"), false, dcx))
|
|
.into()
|
|
}
|
|
|
|
#[proc_macro]
|
|
pub fn pin_init(input: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(input);
|
|
DiagCtxt::with(|dcx| init::expand(input, Some("::core::convert::Infallible"), true, dcx)).into()
|
|
}
|