[PATCH v2 2/2] rust_binder: override crate name to rust_binder

Alice Ryhl posted 2 patches 4 weeks, 1 day ago
There is a newer version of this series
[PATCH v2 2/2] rust_binder: override crate name to rust_binder
Posted by Alice Ryhl 4 weeks, 1 day ago
The Rust Binder object file is called rust_binder_main.o because the
name rust_binder.o is used for the result of linking together
rust_binder_main.o with rust_binderfs.o and a few others.

However, the crate name is supposed to be rust_binder without a _main
suffix. Thus, override the crate name accordingly.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 drivers/android/binder/rust_binder_main.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
index aa5f2a75adb4..14162af0f5a5 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -2,7 +2,9 @@
 
 // Copyright (C) 2025 Google LLC.
 
+#![crate_name = "rust_binder"]
 //! Binder -- the Android IPC mechanism.
+
 #![recursion_limit = "256"]
 #![allow(
     clippy::as_underscore,

-- 
2.53.0.473.g4a7958ca14-goog
Re: [PATCH v2 2/2] rust_binder: override crate name to rust_binder
Posted by Miguel Ojeda 4 weeks, 1 day ago
On Tue, Mar 10, 2026 at 3:53 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
>  // Copyright (C) 2025 Google LLC.
>
> +#![crate_name = "rust_binder"]
>  //! Binder -- the Android IPC mechanism.
> +
>  #![recursion_limit = "256"]
>  #![allow(
>      clippy::as_underscore,

So the crate name is a special crate attribute (together with
`crate_type, it is forbidden inside `cfg_attr`), so I think it makes
in a sense to put it between the SPDX/copyright block and the crate
docs. I also think you didn't add a newline to put it closer to the
title of the docs, as if it were a title of its own.

On the other hand, it is a crate attribute nevertheless, so putting it
together with the rest looks a bit more consistent, and as a title the
English one is probably the best one to see first anyway:

    //! Binder -- the Android IPC mechanism.

    #![crate_name = "rust_binder"]
    #![recursion_limit = "256"]

Hopefully the crate names are still close to the file names (and I
would really not want people to abuse this...).

Cheers,
Miguel