Subject: linux-next: manual merge of the rust tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 17 Mar 2025 21:05:18 +1100

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

  scripts/generate_rust_analyzer.py

between commits:

  d1f928052439 ("scripts: generate_rust_analyzer: add missing include_dirs")
  a1eb95d6b5f4 ("scripts: generate_rust_analyzer: add uapi crate")

from Linus' tree and commits:

  d7659acca7a3 ("rust: add pin-init crate build infrastructure")
  dbd5058ba60c ("rust: make pin-init its own crate")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc scripts/generate_rust_analyzer.py
index adae71544cbd,54228e87e577..000000000000
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@@ -97,29 -85,43 +97,44 @@@ def generate_crates(srctree, objtree, s
          ["core", "compiler_builtins"],
      )
  
 -    append_crate(
 -        "bindings",
 -        srctree / "rust"/ "bindings" / "lib.rs",
 -        ["core"],
 -        cfg=cfg,
 -    )
 -    crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
 +    def append_crate_with_generated(
 +        display_name,
 +        deps,
 +    ):
 +        append_crate(
 +            display_name,
 +            srctree / "rust"/ display_name / "lib.rs",
 +            deps,
 +            cfg=cfg,
 +        )
 +        crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
 +        crates[-1]["source"] = {
 +            "include_dirs": [
 +                str(srctree / "rust" / display_name),
 +                str(objtree / "rust")
 +            ],
 +            "exclude_dirs": [],
 +        }
 +
 +    append_crate_with_generated("bindings", ["core"])
 +    append_crate_with_generated("uapi", ["core"])
 +    append_crate_with_generated("kernel", ["core", "macros", "build_error", "bindings", "uapi"])
  
+     append_crate(
+         "pin_init_internal",
+         srctree / "rust" / "pin-init" / "internal" / "src" / "lib.rs",
+         [],
+         cfg=["kernel"],
+         is_proc_macro=True,
+     )
+ 
+     append_crate(
+         "pin_init",
+         srctree / "rust" / "pin-init" / "src" / "lib.rs",
+         ["core", "pin_init_internal", "macros"],
+         cfg=["kernel"],
+     )
+ 
 -    append_crate(
 -        "kernel",
 -        srctree / "rust" / "kernel" / "lib.rs",
 -        ["core", "macros", "build_error", "bindings", "pin_init"],
 -        cfg=cfg,
 -    )
 -    crates[-1]["source"] = {
 -        "include_dirs": [
 -            str(srctree / "rust" / "kernel"),
 -            str(objtree / "rust")
 -        ],
 -        "exclude_dirs": [],
 -    }
 -
      def is_root_crate(build_file, target):
          try:
              return f"{target}.o" in open(build_file).read()