Re: linux-next: build failure after merge of the rust tree

From: Alice Ryhl
Date: Fri Jan 10 2025 - 04:46:52 EST


On Fri, Jan 10, 2025 at 10:34 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jan 10, 2025 at 10:28:46AM +0100, Alice Ryhl wrote:
> > On Fri, Jan 10, 2025 at 6:28 AM Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > Hi all,
> > >
> > > After merging the rust tree, today's linux-next build (x86_64
> > > allmodconfig) failed like this:
> > >
> > > error[E0423]: expected function, found macro `kernel::build_error`
> > > --> rust/kernel/miscdevice.rs:159:9
> > > |
> > > 159 | kernel::build_error(VTABLE_DEFAULT_ERROR)
> > > | ^^^^^^^^^^^^^^^^^^^ not a function
> > > |
> > > help: use `!` to invoke the macro
> > > |
> > > 159 | kernel::build_error!(VTABLE_DEFAULT_ERROR)
> > > | +
> > > help: consider importing one of these functions instead
> > > |
> > > 11 + use crate::build_assert::build_error;
> > > |
> > > 11 + use build_error::build_error;
> > > |
> > > help: if you import `build_error`, refer to it directly
> > > |
> > > 159 - kernel::build_error(VTABLE_DEFAULT_ERROR)
> > > 159 + build_error(VTABLE_DEFAULT_ERROR)
> > > |
> > >
> > > error: aborting due to 1 previous error
> > >
> > > For more information about this error, try `rustc --explain E0423`.
> > >
> > > Caused by commit
> > >
> > > 614724e780f5 ("rust: kernel: move `build_error` hidden function to prevent mistakes")
> > >
> > > interacting with commit
> > >
> > > 5bcc8bfe841b ("rust: miscdevice: add fops->show_fdinfo() hook")
> > >
> > > from the driver-core tree.
> > >
> > > I have added the following merge resolution patch.
> > >
> > > From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > > Date: Fri, 10 Jan 2025 16:02:19 +1100
> > > Subject: [PATCH] fix up for "rust: kernel: move `build_error` hidden function
> > > to prevent mistakes"
> > >
> > > interacting with commit
> > >
> > > 5bcc8bfe841b ("rust: miscdevice: add fops->show_fdinfo() hook")
> > >
> > > from the driver-core tree.
> > >
> > > Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > > ---
> > > rust/kernel/miscdevice.rs | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs
> > > index 9685e50b100d..3ba018651bc0 100644
> > > --- a/rust/kernel/miscdevice.rs
> > > +++ b/rust/kernel/miscdevice.rs
> > > @@ -156,7 +156,7 @@ fn show_fdinfo(
> > > _m: &SeqFile,
> > > _file: &File,
> > > ) {
> > > - kernel::build_error(VTABLE_DEFAULT_ERROR)
> > > + build_error!(VTABLE_DEFAULT_ERROR)
> > > }
> > > }
> >
> > Thank you, this fix is correct. Greg, can you pick this up directly,
> > or do you want a real patch?
>
> Can I take this as a real patch for my tree? Or is this only an issue
> due to the trees being merged?

You can take it as a real patch. That will make your tree compile both
with and without rust-next merged.

Though I guess it would be nice to update all three instances of
build_error! if we make a real patch. (The other two instances are
updated in rust-next, so they don't cause the failure.)

Alice