public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Change Rust Binder crate name to rust_binder
@ 2026-04-02 10:55 Alice Ryhl
  2026-04-02 10:55 ` [PATCH v4 1/2] rust: support overriding crate_name Alice Ryhl
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alice Ryhl @ 2026-04-02 10:55 UTC (permalink / raw)
  To: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux, Alice Ryhl

Currently the crate name of the Rust Binder driver is rust_binder_main,
but I'd like it to be called rust_binder instead, matching the .ko file.
This affects e.g. symbol names in stack traces.

Thus, allow use of the #![crate_name] annotation, and set it for Rust
Binder.

I tried just using RUSTFLAGS_stem.o and RUSTFLAGS_REMOVE_stem.o, but
RUSTFLAGS_REMOVE_ is incapable of removing the --crate-name argument.
(Even after changing --crate-name to be passed with = instead of space
as the separator to the name.)

This cross-subsystem series is intended to be merged via rust-next.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Changes in v4:
- Rebase on rust-next.
- Link to v3: https://lore.kernel.org/r/20260323-binder-crate-name-v3-0-c6e00f239fb1@google.com

Changes in v3:
- Move #![crate_name = "rust_binder] a few lines down.
- Expand on file names not changing in commit message.
- Make rust analyzer python script a bit cleaner.
- Link to v2: https://lore.kernel.org/r/20260310-binder-crate-name-v2-0-0f7c97900d36@google.com

Changes in v2:
- Do not pass --crate-name and specify crate name using annotation
  inside .rs file.
- Link to v1: https://lore.kernel.org/r/20260224-binder-crate-name-v1-0-7dfc1289abbd@google.com

---
Alice Ryhl (2):
      rust: support overriding crate_name
      rust_binder: override crate name to rust_binder

 drivers/android/binder/rust_binder_main.rs |  2 ++
 scripts/Makefile.build                     |  1 -
 scripts/generate_rust_analyzer.py          | 46 ++++++++++++++++--------------
 3 files changed, 26 insertions(+), 23 deletions(-)
---
base-commit: 3418d862679ac6da0b6bd681b18b3189c4fad20d
change-id: 20260224-binder-crate-name-15f14e134fca

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/2] rust: support overriding crate_name
  2026-04-02 10:55 [PATCH v4 0/2] Change Rust Binder crate name to rust_binder Alice Ryhl
@ 2026-04-02 10:55 ` Alice Ryhl
  2026-04-02 12:22   ` Jesung Yang
  2026-04-02 10:55 ` [PATCH v4 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
  2026-04-03 10:05 ` [PATCH v4 0/2] Change Rust Binder " Miguel Ojeda
  2 siblings, 1 reply; 10+ messages in thread
From: Alice Ryhl @ 2026-04-02 10:55 UTC (permalink / raw)
  To: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux, Alice Ryhl

Currently you cannot filter out the crate-name argument
RUSTFLAGS_REMOVE_stem.o because the Rust filter-out invocation does not
include that particular argument. Since --crate-name is an argument that
can't be passed multiple times, this means that it's currently not
possible to override the crate name. Thus, remove the --crate-name
argument for drivers. This allows them to override the crate name using
the #![crate_name] annotation.

This affects symbol names, but has no effect on the filenames of object
files and other things generated by the build, as we always use --emit
with a fixed output filename.

The --crate-name argument is kept for the crates under rust/ for
simplicity and to avoid changing many of them by adding #![crate_name].

The rust analyzer script is updated to use rustc to obtain the crate
name of the driver crates, which picks up the right name whether it is
configured via #![crate_name] or not. For readability, the logic to
invoke 'rustc' is extracted to its own function.

Note that the crate name in the python script is not actually that
important - the only place where the name actually affects anything is
in the 'deps' array which specifies an index and name for each
dependency, and determines what that dependency is called in *this*
crate. (The same crate may be called different things in each
dependency.) Since driver crates are leaf crates, this doesn't apply and
the rustc invocation only affects the 'display_name' parameter.

Acked-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 scripts/Makefile.build            |  1 -
 scripts/generate_rust_analyzer.py | 46 ++++++++++++++++++++-------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a6d1a2b210aa..0b0245106d01 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -333,7 +333,6 @@ rust_common_cmd = \
 	-Zcrate-attr='feature($(rust_allowed_features))' \
 	-Zunstable-options --extern pin_init --extern kernel \
 	--crate-type rlib -L $(objtree)/rust/ \
-	--crate-name $(basename $(notdir $@)) \
 	--sysroot=/dev/null \
 	--out-dir $(dir $@) --emit=dep-info=$(depfile)
 
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index b4a55344688d..de6ebf14e2b8 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -12,6 +12,12 @@ import subprocess
 import sys
 from typing import Dict, Iterable, List, Literal, Optional, TypedDict
 
+def invoke_rustc(args):
+    return subprocess.check_output(
+        [os.environ["RUSTC"]] + args,
+        stdin=subprocess.DEVNULL,
+    ).decode('utf-8').strip()
+
 def args_crates_cfgs(cfgs: List[str]) -> Dict[str, List[str]]:
     crates_cfgs = {}
     for cfg in cfgs:
@@ -69,6 +75,9 @@ def generate_crates(
     crates: List[Crate] = []
     crates_cfgs = args_crates_cfgs(cfgs)
 
+    def get_crate_name(path):
+        return invoke_rustc(["--print", "crate-name", path])
+
     def build_crate(
         display_name: str,
         root_module: pathlib.Path,
@@ -112,23 +121,15 @@ def generate_crates(
             is_workspace_member=is_workspace_member,
             edition=edition,
         )
-        proc_macro_dylib_name = (
-            subprocess.check_output(
-                [
-                    os.environ["RUSTC"],
-                    "--print",
-                    "file-names",
-                    "--crate-name",
-                    display_name,
-                    "--crate-type",
-                    "proc-macro",
-                    "-",
-                ],
-                stdin=subprocess.DEVNULL,
-            )
-            .decode("utf-8")
-            .strip()
-        )
+        proc_macro_dylib_name = invoke_rustc([
+            "--print",
+            "file-names",
+            "--crate-name",
+            display_name,
+            "--crate-type",
+            "proc-macro",
+            "-",
+        ])
         proc_macro_crate: ProcMacroCrate = {
             **crate,
             "is_proc_macro": True,
@@ -324,16 +325,17 @@ def generate_crates(
     for folder in extra_dirs:
         for path in folder.rglob("*.rs"):
             logging.info("Checking %s", path)
-            name = path.stem
+            file_name = path.stem
 
             # Skip those that are not crate roots.
-            if not is_root_crate(path.parent / "Makefile", name) and \
-               not is_root_crate(path.parent / "Kbuild", name):
+            if not is_root_crate(path.parent / "Makefile", file_name) and \
+               not is_root_crate(path.parent / "Kbuild", file_name):
                 continue
 
-            logging.info("Adding %s", name)
+            crate_name = get_crate_name(path)
+            logging.info("Adding %s", crate_name)
             append_crate(
-                name,
+                crate_name,
                 path,
                 [core, kernel, pin_init],
                 cfg=generated_cfg,

-- 
2.53.0.1185.g05d4b7b318-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/2] rust_binder: override crate name to rust_binder
  2026-04-02 10:55 [PATCH v4 0/2] Change Rust Binder crate name to rust_binder Alice Ryhl
  2026-04-02 10:55 ` [PATCH v4 1/2] rust: support overriding crate_name Alice Ryhl
@ 2026-04-02 10:55 ` Alice Ryhl
  2026-04-02 11:08   ` Greg Kroah-Hartman
  2026-04-02 11:14   ` Gary Guo
  2026-04-03 10:05 ` [PATCH v4 0/2] Change Rust Binder " Miguel Ojeda
  2 siblings, 2 replies; 10+ messages in thread
From: Alice Ryhl @ 2026-04-02 10:55 UTC (permalink / raw)
  To: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux, Alice Ryhl

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..85a15dd40bec 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -3,6 +3,8 @@
 // Copyright (C) 2025 Google LLC.
 
 //! Binder -- the Android IPC mechanism.
+
+#![crate_name = "rust_binder"]
 #![recursion_limit = "256"]
 #![allow(
     clippy::as_underscore,

-- 
2.53.0.1185.g05d4b7b318-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/2] rust_binder: override crate name to rust_binder
  2026-04-02 10:55 ` [PATCH v4 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
@ 2026-04-02 11:08   ` Greg Kroah-Hartman
  2026-04-02 11:14   ` Gary Guo
  1 sibling, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2026-04-02 11:08 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Carlos Llamas, linux-kbuild, linux-kernel, rust-for-linux

On Thu, Apr 02, 2026 at 10:55:34AM +0000, Alice Ryhl wrote:
> 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(+)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/2] rust_binder: override crate name to rust_binder
  2026-04-02 10:55 ` [PATCH v4 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
  2026-04-02 11:08   ` Greg Kroah-Hartman
@ 2026-04-02 11:14   ` Gary Guo
  1 sibling, 0 replies; 10+ messages in thread
From: Gary Guo @ 2026-04-02 11:14 UTC (permalink / raw)
  To: Alice Ryhl, Miguel Ojeda, Tamir Duberstein, Nathan Chancellor,
	Nicolas Schier
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On Thu Apr 2, 2026 at 11:55 AM BST, Alice Ryhl wrote:
> 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>

Acked-by: Gary Guo <gary@garyguo.net>

> ---
>  drivers/android/binder/rust_binder_main.rs | 2 ++
>  1 file changed, 2 insertions(+)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/2] rust: support overriding crate_name
  2026-04-02 10:55 ` [PATCH v4 1/2] rust: support overriding crate_name Alice Ryhl
@ 2026-04-02 12:22   ` Jesung Yang
  2026-04-02 12:33     ` Alice Ryhl
  0 siblings, 1 reply; 10+ messages in thread
From: Jesung Yang @ 2026-04-02 12:22 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On Thu, Apr 2, 2026 at 10:55 AM Alice Ryhl <aliceryhl@google.com> wrote:
[...]
> diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> index b4a55344688d..de6ebf14e2b8 100755
> --- a/scripts/generate_rust_analyzer.py
> +++ b/scripts/generate_rust_analyzer.py
> @@ -12,6 +12,12 @@ import subprocess
>  import sys
>  from typing import Dict, Iterable, List, Literal, Optional, TypedDict
>
> +def invoke_rustc(args):
> +    return subprocess.check_output(
> +        [os.environ["RUSTC"]] + args,
> +        stdin=subprocess.DEVNULL,
> +    ).decode('utf-8').strip()
> +
>  def args_crates_cfgs(cfgs: List[str]) -> Dict[str, List[str]]:
>      crates_cfgs = {}
>      for cfg in cfgs:
> @@ -69,6 +75,9 @@ def generate_crates(
>      crates: List[Crate] = []
>      crates_cfgs = args_crates_cfgs(cfgs)
>
> +    def get_crate_name(path):
> +        return invoke_rustc(["--print", "crate-name", path])
> +

Could you add type hints to `invoke_rustc` and `get_crate_name`? You can
run the following command to verify if it's all good:

mypy --strict scripts/generate_rust_analyzer.py --python-version 3.9

Once that's done, for the script part:

Reviewed-by: Jesung Yang <y.jems.n@gmail.com>

Best regards,
Jesung

>      def build_crate(
>          display_name: str,
>          root_module: pathlib.Path,
> @@ -112,23 +121,15 @@ def generate_crates(
>              is_workspace_member=is_workspace_member,
>              edition=edition,
>          )
> -        proc_macro_dylib_name = (
> -            subprocess.check_output(
> -                [
> -                    os.environ["RUSTC"],
> -                    "--print",
> -                    "file-names",
> -                    "--crate-name",
> -                    display_name,
> -                    "--crate-type",
> -                    "proc-macro",
> -                    "-",
> -                ],
> -                stdin=subprocess.DEVNULL,
> -            )
> -            .decode("utf-8")
> -            .strip()
> -        )
> +        proc_macro_dylib_name = invoke_rustc([
> +            "--print",
> +            "file-names",
> +            "--crate-name",
> +            display_name,
> +            "--crate-type",
> +            "proc-macro",
> +            "-",
> +        ])
>          proc_macro_crate: ProcMacroCrate = {
>              **crate,
>              "is_proc_macro": True,
> @@ -324,16 +325,17 @@ def generate_crates(
>      for folder in extra_dirs:
>          for path in folder.rglob("*.rs"):
>              logging.info("Checking %s", path)
> -            name = path.stem
> +            file_name = path.stem
>
>              # Skip those that are not crate roots.
> -            if not is_root_crate(path.parent / "Makefile", name) and \
> -               not is_root_crate(path.parent / "Kbuild", name):
> +            if not is_root_crate(path.parent / "Makefile", file_name) and \
> +               not is_root_crate(path.parent / "Kbuild", file_name):
>                  continue
>
> -            logging.info("Adding %s", name)
> +            crate_name = get_crate_name(path)
> +            logging.info("Adding %s", crate_name)
>              append_crate(
> -                name,
> +                crate_name,
>                  path,
>                  [core, kernel, pin_init],
>                  cfg=generated_cfg,
>
> --
> 2.53.0.1185.g05d4b7b318-goog
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/2] rust: support overriding crate_name
  2026-04-02 12:22   ` Jesung Yang
@ 2026-04-02 12:33     ` Alice Ryhl
  2026-04-02 12:56       ` Jesung Yang
  2026-04-02 15:21       ` Tamir Duberstein
  0 siblings, 2 replies; 10+ messages in thread
From: Alice Ryhl @ 2026-04-02 12:33 UTC (permalink / raw)
  To: Jesung Yang
  Cc: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On Thu, Apr 2, 2026 at 2:23 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
>
> On Thu, Apr 2, 2026 at 10:55 AM Alice Ryhl <aliceryhl@google.com> wrote:
> [...]
> > diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> > index b4a55344688d..de6ebf14e2b8 100755
> > --- a/scripts/generate_rust_analyzer.py
> > +++ b/scripts/generate_rust_analyzer.py
> > @@ -12,6 +12,12 @@ import subprocess
> >  import sys
> >  from typing import Dict, Iterable, List, Literal, Optional, TypedDict
> >
> > +def invoke_rustc(args):
> > +    return subprocess.check_output(
> > +        [os.environ["RUSTC"]] + args,
> > +        stdin=subprocess.DEVNULL,
> > +    ).decode('utf-8').strip()
> > +
> >  def args_crates_cfgs(cfgs: List[str]) -> Dict[str, List[str]]:
> >      crates_cfgs = {}
> >      for cfg in cfgs:
> > @@ -69,6 +75,9 @@ def generate_crates(
> >      crates: List[Crate] = []
> >      crates_cfgs = args_crates_cfgs(cfgs)
> >
> > +    def get_crate_name(path):
> > +        return invoke_rustc(["--print", "crate-name", path])
> > +
>
> Could you add type hints to `invoke_rustc` and `get_crate_name`? You can
> run the following command to verify if it's all good:
>
> mypy --strict scripts/generate_rust_analyzer.py --python-version 3.9

This seems to work.

def invoke_rustc(args: List[str]) -> str:
    return subprocess.check_output(
        [os.environ["RUSTC"]] + args,
        stdin=subprocess.DEVNULL,
    ).decode('utf-8').strip()

and

def get_crate_name(path: pathlib.Path) -> str:
    return invoke_rustc(["--print", "crate-name", str(path)])

Does that look ok to you? If so, perhaps Miguel can use these on apply?

> Once that's done, for the script part:
>
> Reviewed-by: Jesung Yang <y.jems.n@gmail.com>

Thanks!

Alice

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/2] rust: support overriding crate_name
  2026-04-02 12:33     ` Alice Ryhl
@ 2026-04-02 12:56       ` Jesung Yang
  2026-04-02 15:21       ` Tamir Duberstein
  1 sibling, 0 replies; 10+ messages in thread
From: Jesung Yang @ 2026-04-02 12:56 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On Thu, Apr 2, 2026 at 12:34 PM Alice Ryhl <aliceryhl@google.com> wrote:
> On Thu, Apr 2, 2026 at 2:23 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
> > On Thu, Apr 2, 2026 at 10:55 AM Alice Ryhl <aliceryhl@google.com> wrote:
> > [...]
> > > diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> > > index b4a55344688d..de6ebf14e2b8 100755
> > > --- a/scripts/generate_rust_analyzer.py
> > > +++ b/scripts/generate_rust_analyzer.py
> > > @@ -12,6 +12,12 @@ import subprocess
> > >  import sys
> > >  from typing import Dict, Iterable, List, Literal, Optional, TypedDict
> > >
> > > +def invoke_rustc(args):
> > > +    return subprocess.check_output(
> > > +        [os.environ["RUSTC"]] + args,
> > > +        stdin=subprocess.DEVNULL,
> > > +    ).decode('utf-8').strip()
> > > +
> > >  def args_crates_cfgs(cfgs: List[str]) -> Dict[str, List[str]]:
> > >      crates_cfgs = {}
> > >      for cfg in cfgs:
> > > @@ -69,6 +75,9 @@ def generate_crates(
> > >      crates: List[Crate] = []
> > >      crates_cfgs = args_crates_cfgs(cfgs)
> > >
> > > +    def get_crate_name(path):
> > > +        return invoke_rustc(["--print", "crate-name", path])
> > > +
> >
> > Could you add type hints to `invoke_rustc` and `get_crate_name`? You can
> > run the following command to verify if it's all good:
> >
> > mypy --strict scripts/generate_rust_analyzer.py --python-version 3.9
>
> This seems to work.
>
> def invoke_rustc(args: List[str]) -> str:
>     return subprocess.check_output(
>         [os.environ["RUSTC"]] + args,
>         stdin=subprocess.DEVNULL,
>     ).decode('utf-8').strip()
>
> and
>
> def get_crate_name(path: pathlib.Path) -> str:
>     return invoke_rustc(["--print", "crate-name", str(path)])
>
> Does that look ok to you? If so, perhaps Miguel can use these on apply?

Looks good to me!

> > Once that's done, for the script part:
> >
> > Reviewed-by: Jesung Yang <y.jems.n@gmail.com>
>
> Thanks!

You're welcome :)

Best regards,
Jesung

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/2] rust: support overriding crate_name
  2026-04-02 12:33     ` Alice Ryhl
  2026-04-02 12:56       ` Jesung Yang
@ 2026-04-02 15:21       ` Tamir Duberstein
  1 sibling, 0 replies; 10+ messages in thread
From: Tamir Duberstein @ 2026-04-02 15:21 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Jesung Yang, Miguel Ojeda, Tamir Duberstein, Nathan Chancellor,
	Nicolas Schier, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On 2026-04-02 14:33:49+02:00, Alice Ryhl wrote:
> On Thu, Apr 2, 2026 at 2:23 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
> 
> > On Thu, Apr 2, 2026 at 10:55 AM Alice Ryhl <aliceryhl@google.com> wrote:
> > [...]
> >
> > Could you add type hints to `invoke_rustc` and `get_crate_name`? You can
> > run the following command to verify if it's all good:
> >
> > mypy --strict scripts/generate_rust_analyzer.py --python-version 3.9
> 
> This seems to work.
> 
> def invoke_rustc(args: List[str]) -> str:
>     return subprocess.check_output(
>         [os.environ["RUSTC"]] + args,
>         stdin=subprocess.DEVNULL,
>     ).decode('utf-8').strip()
> 
> and
> 
> def get_crate_name(path: pathlib.Path) -> str:
>     return invoke_rustc(["--print", "crate-name", str(path)])
> 
> Does that look ok to you? If so, perhaps Miguel can use these on apply?
> 
> > Once that's done, for the script part:
> >
> > Reviewed-by: Jesung Yang <y.jems.n@gmail.com>
> 
> Thanks!
> 
> Alice

With the above changes and after confirming `mypy --strict
scripts/generate_rust_analyzer.py --python-version 3.9` is happy:

Acked-by: Tamir Duberstein <tamird@kernel.org>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 0/2] Change Rust Binder crate name to rust_binder
  2026-04-02 10:55 [PATCH v4 0/2] Change Rust Binder crate name to rust_binder Alice Ryhl
  2026-04-02 10:55 ` [PATCH v4 1/2] rust: support overriding crate_name Alice Ryhl
  2026-04-02 10:55 ` [PATCH v4 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
@ 2026-04-03 10:05 ` Miguel Ojeda
  2 siblings, 0 replies; 10+ messages in thread
From: Miguel Ojeda @ 2026-04-03 10:05 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Tamir Duberstein, Nathan Chancellor, Nicolas Schier,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Jesung Yang,
	Greg Kroah-Hartman, Carlos Llamas, linux-kbuild, linux-kernel,
	rust-for-linux

On Thu, Apr 2, 2026 at 12:55 PM Alice Ryhl <aliceryhl@google.com> 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, matching the .ko file.
> This affects e.g. symbol names in stack traces.
>
> Thus, allow use of the #![crate_name] annotation, and set it for Rust
> Binder.

Applied to `rust-next` -- thanks everyone!

    [ Applied Python type hints. - Miguel ]

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-04-03 10:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 10:55 [PATCH v4 0/2] Change Rust Binder crate name to rust_binder Alice Ryhl
2026-04-02 10:55 ` [PATCH v4 1/2] rust: support overriding crate_name Alice Ryhl
2026-04-02 12:22   ` Jesung Yang
2026-04-02 12:33     ` Alice Ryhl
2026-04-02 12:56       ` Jesung Yang
2026-04-02 15:21       ` Tamir Duberstein
2026-04-02 10:55 ` [PATCH v4 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
2026-04-02 11:08   ` Greg Kroah-Hartman
2026-04-02 11:14   ` Gary Guo
2026-04-03 10:05 ` [PATCH v4 0/2] Change Rust Binder " Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox