summaryrefslogtreecommitdiff
path: root/rust/macros
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2024-11-24 01:28:49 +0300
committerMiguel Ojeda <ojeda@kernel.org>2025-01-10 02:19:09 +0300
commit4401565fe92be6ee54a68ea58d80a4076007d5eb (patch)
treeab32e3e48391932767d59d56a01c5f699869471d /rust/macros
parent614724e780f587c8321f027ca539b39f32796406 (diff)
downloadlinux-4401565fe92be6ee54a68ea58d80a4076007d5eb.tar.xz
rust: add `build_error!` to the prelude
The sibling `build_assert!` is already in the prelude, it makes sense that a "core"/"language" facility like this is part of the prelude and users should not be defining their own one (thus there should be no risk of future name collisions and we would want to be aware of them anyway). Thus add `build_error!` into the prelude. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20241123222849.350287-3-ojeda@kernel.org [ Applied the change to the new miscdevice cases. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/macros')
-rw-r--r--rust/macros/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index 1a30c8075ebd..d61bc6a56425 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -123,12 +123,12 @@ pub fn module(ts: TokenStream) -> TokenStream {
/// used on the Rust side, it should not be possible to call the default
/// implementation. This is done to ensure that we call the vtable methods
/// through the C vtable, and not through the Rust vtable. Therefore, the
-/// default implementation should call `kernel::build_error!`, which prevents
+/// default implementation should call `build_error!`, which prevents
/// calls to this function at compile time:
///
/// ```compile_fail
/// # // Intentionally missing `use`s to simplify `rusttest`.
-/// kernel::build_error!(VTABLE_DEFAULT_ERROR)
+/// build_error!(VTABLE_DEFAULT_ERROR)
/// ```
///
/// Note that you might need to import [`kernel::error::VTABLE_DEFAULT_ERROR`].
@@ -145,11 +145,11 @@ pub fn module(ts: TokenStream) -> TokenStream {
/// #[vtable]
/// pub trait Operations: Send + Sync + Sized {
/// fn foo(&self) -> Result<()> {
-/// kernel::build_error!(VTABLE_DEFAULT_ERROR)
+/// build_error!(VTABLE_DEFAULT_ERROR)
/// }
///
/// fn bar(&self) -> Result<()> {
-/// kernel::build_error!(VTABLE_DEFAULT_ERROR)
+/// build_error!(VTABLE_DEFAULT_ERROR)
/// }
/// }
///