Re: [PATCH v2 2/5] rust: macros: support additional tokens in quote!

2025-02-28 Thread Andreas Hindborg
is: > > const _: () = { > if true { > ::kernel::bindings::#name > } else { > #name > }; > }; > > where #name has type Ident. > > Signed-off-by: Alice Ryhl Reviewed-by: Andreas Hindborg Best regards, Andreas Hindborg

Re: [PATCH v2 3/5] rust: add #[export] macro

2025-02-28 Thread Andreas Hindborg
ut by saying "`if` and > `else` have incompatible types", but I believe the rest of the error > message is reasonably clear and not too confusing. > > Signed-off-by: Alice Ryhl Reviewed-by: Andreas Hindborg Best regards, Andreas Hindborg

Re: [PATCH 2/4] rust: add #[export] macro

2025-02-28 Thread Andreas Hindborg
,6 +143,16 @@ macro_rules! quote_spanned { > )); > quote_spanned!(@proc $v $span $($tt)*); > }; > +(@proc $v:ident $span:ident = $($tt:tt)*) => { > +$v.push(::proc_macro::TokenTree::Punct( > +::proc_macro::Punct::new('=', ::proc_macro::Spacing::Alone) > +)); > +quote_spanned!(@proc $v $span $($tt)*); > +}; > +(@proc $v:ident $span:ident _ $($tt:tt)*) => { > +$v.push(::proc_macro::TokenTree::Ident(::proc_macro::Ident::new("_", > $span))); > +quote_spanned!(@proc $v $span $($tt)*); > +}; > (@proc $v:ident $span:ident $id:ident $($tt:tt)*) => { > > $v.push(::proc_macro::TokenTree::Ident(::proc_macro::Ident::new(stringify!($id), > $span))); > quote_spanned!(@proc $v $span $($tt)*); The update to `impl ToTokens for TokenTree` should be split out in a separate patch and should carry some explanation of the change. Best regards, Andreas Hindborg

Re: [PATCH 0/4] Check Rust signatures at compile time

2025-02-28 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Fri, Feb 28, 2025 at 8:19 AM Andreas Hindborg > wrote: >> >> "Alice Ryhl" writes: >> >> > Signed-off-by: Alice Ryhl >> >> What is going on with the cover letter of this one? > > It's empt

Re: [PATCH 2/4] rust: add #[export] macro

2025-02-28 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Fri, Feb 28, 2025 at 9:20 AM Andreas Hindborg > wrote: >> >> "Alice Ryhl" writes: >> >> > This macro behaves like #[no_mangle], but also performs an assertion >> > that the Rust function has the same si

Re: [PATCH 1/4] rust: fix signature of rust_fmt_argument

2025-02-28 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Fri, Feb 28, 2025 at 9:20 AM Andreas Hindborg > wrote: >> >> "Alice Ryhl" writes: >> >> > Without this change, the rest of this series will emit the following >> > error message: >> > >> &g

Re: [PATCH 4/4] panic_qr: use new #[export] macro

2025-02-28 Thread Andreas Hindborg
afe extern "C" fn(_, _) -> _ > {kernel::bindings::drm_panic_qr_max_data_size}` >found fn item `extern "C" fn(_, _) -> _ > {drm_panic_qr_max_data_size}` > > Signed-off-by: Alice Ryhl Reviewed-by: Andreas Hindborg Best regards, Andreas Hindborg

Re: [PATCH 3/4] print: use new #[export] macro for rust_fmt_argument

2025-02-28 Thread Andreas Hindborg
"Alice Ryhl" writes: > This moves the rust_fmt_argument function over to use the new #[export] > macro, which will verify at compile-time that the function signature > matches what is in the header file. > > Signed-off-by: Alice Ryhl Reviewed-by: Andreas Hindborg

Re: [PATCH 1/4] rust: fix signature of rust_fmt_argument

2025-02-28 Thread Andreas Hindborg
ust/kernel/print.rs > +++ b/rust/kernel/print.rs > @@ -6,13 +6,13 @@ > //! > //! Reference: <https://docs.kernel.org/core-api/printk-basics.html> > > -use core::{ > +use core::fmt; > + > +use crate::{ > ffi::{c_char, c_void}, > -fmt, > +str::RawF

Re: [PATCH 0/4] Check Rust signatures at compile time

2025-02-27 Thread Andreas Hindborg
"Alice Ryhl" writes: > Signed-off-by: Alice Ryhl What is going on with the cover letter of this one? Best regards, Andreas Hindborg