Re: [PATCH 0/2] Change Rust Binder crate name to rust_binder
From: Alice Ryhl
Date: Thu Mar 05 2026 - 05:50:15 EST
On Tue, Feb 24, 2026 at 03:17:16PM +0000, Alice Ryhl wrote:
> On Tue, Feb 24, 2026 at 02:24:59PM +0100, Miguel Ojeda wrote:
> > On Tue, Feb 24, 2026 at 10:38 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> > >
> > > Currently the crate name of the Rust Binder driver is rust_binder_main,
> > > but I'd like it to be called rust_binder instead. This affects e.g.
> > > symbol names in stack traces.
> >
> > We discussed allowing to customize crate names years ago, at least for
> > dashes vs. underscores, for matching C names more closely and perhaps
> > other needs.
> >
> > Back then, we decided to keep things simple to avoid confusion (i.e. a
> > single identifier used everywhere the same way is simpler, at least
> > for humans) and to avoid having to deal with those dual names
> > everywhere (e.g. adding workarounds for rust-analyzer here).
> >
> > I talked with Alice about what she needed here -- could we rename that
> > source file to just something like `binder`? That would avoid the need
> > to have a custom name, so everything would still match (symbols,
> > source file, object file...), and it would give you even shorter
> > names.
>
> Sure just renaming rust_binder_main.rs to binder.rs would work too.
I realized that there's a much simpler way to allow crates to rename
themselves: do not pass the --crate-name argument at all.
Because if you do not pass this argument, then rustc will use the
name of the .rs file as the crate name by default, *but* if the crate
contains #![crate_name = "..."], then that will be used instead.
Do you still want to enforce that the crate name always matches the
file name? It seems unfortunate that it's currently impossible to create
a Rust module where the .ko file and crate name is the same, unless no
extra object files are linked into the module.
Alice