)]}'
{
  "commit": "a700d1ab5a6897a11edfdeb8f5a4ae2473b9b404",
  "tree": "227edc9096ee349f5e4871486e43d66b04301329",
  "parents": [
    "7a7ea1c3b4f2c510d023b6421d18dfb5546e5175"
  ],
  "author": {
    "name": "Krasimir Georgiev",
    "email": "krasimir@google.com",
    "time": "Tue Jul 21 13:07:36 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Jul 21 11:07:36 2026 +0000"
  },
  "message": "Add `root_path` attribute for directory crate roots (#4142)\n\nAllows specifying `root_path` when the crate root (`srcs` entrypoint) is\na directory artifact (`TreeArtifact`). This enables rules_rust targets\n(`rust_library`, `rust_binary`, `rust_test`, etc.) to consume directory\nartifacts produced by upstream rules and correctly construct the path to\nthe crate root (`lib.rs` / `main.rs`).\n\nWe use something like this internally to build standard libraries from\nsources distributed as .zip source archives: a custom rule extracts the\ncontents into a generated directory artifact, which then the rust rules\ncan consume as sources.\n\nThis may be helpful to achieve the request from\nhttps://github.com/bazelbuild/rules_rust/issues/3757, where the user is\ntrying to consume a directory of generated sources.\n\n* Adds `root_path` attribute to `_COMMON_ATTRS` and `CrateInfo`\nprovider.\n* Updates `rustc_compile_action` argument construction (`rustc.bzl`) to\njoin `crate_info.root.path` with `root_path` when\n`crate_info.root.is_directory` is true.\n* Adds a unit and build test case under `test/root_path/` using a custom\nrule that packages its `srcs` as a directory artifact (`TreeArtifact`)\nand compiles a `rust_library` and `rust_test` from it.\n\nI have taken special care in the rustc argument construction to ensure\nit is compatible with the new [bazel path remapping\nguidelines](https://github.com/bazelbuild/bazel/discussions/22658).\n\nWhile here, added a few checks in the rules for combinations of `srcs`,\n`crate` and `crate_root` attributes that don\u0027t make sense and would\ncause compilation to fail later anyways.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "62a833e8d6c4776ab12a8783a2dd45d5d6fb6ebd",
      "old_mode": 33188,
      "old_path": "rust/private/common.bzl",
      "new_id": "1291ea9230077cf630122dfc3960923b70917233",
      "new_mode": 33188,
      "new_path": "rust/private/common.bzl"
    },
    {
      "type": "modify",
      "old_id": "a531884d19623add80670ac1edf56248553814c7",
      "old_mode": 33188,
      "old_path": "rust/private/providers.bzl",
      "new_id": "e6ca1a4e62bb131915355837130d84dba66ebd33",
      "new_mode": 33188,
      "new_path": "rust/private/providers.bzl"
    },
    {
      "type": "modify",
      "old_id": "3543cd6ba3d306cf6885098b1acaddfface0513d",
      "old_mode": 33188,
      "old_path": "rust/private/rust.bzl",
      "new_id": "0697c6c2f86ebe6a2986e426ff2847eabc3f0f7c",
      "new_mode": 33188,
      "new_path": "rust/private/rust.bzl"
    },
    {
      "type": "modify",
      "old_id": "71afd9c86851c6879781fbc05608e2bfdb3b6a7a",
      "old_mode": 33188,
      "old_path": "rust/private/rustc.bzl",
      "new_id": "725a00aa41eeb6e72dcd5b50bd3c774779d63816",
      "new_mode": 33188,
      "new_path": "rust/private/rustc.bzl"
    },
    {
      "type": "modify",
      "old_id": "b3c21b80576501c0ee0124014b3afdac081bad7b",
      "old_mode": 33188,
      "old_path": "rust/private/rustdoc.bzl",
      "new_id": "8c530a8a10282cc90f1c2f1068f29307293d1b3d",
      "new_mode": 33188,
      "new_path": "rust/private/rustdoc.bzl"
    },
    {
      "type": "modify",
      "old_id": "bf961b36a9fa1f9e4008dbd1b4fbaefedb038f98",
      "old_mode": 33188,
      "old_path": "rust/private/rustdoc_test.bzl",
      "new_id": "733444eff783e3a54341949cb9268f3a5dac382f",
      "new_mode": 33188,
      "new_path": "rust/private/rustdoc_test.bzl"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "3c56567327bdd79c9ae1085e33713717b49eab0c",
      "new_mode": 33188,
      "new_path": "test/root_path/BUILD.bazel"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e56b98b6334e93278551a2c64aa11489d3952612",
      "new_mode": 33188,
      "new_path": "test/root_path/defs.bzl"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "aa21589f4bdb9dc7afcdd1f508e47d9967bbffee",
      "new_mode": 33188,
      "new_path": "test/root_path/src/lib.rs"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "bda56e17f49b2ad6a506f5486970a4d24f58b780",
      "new_mode": 33188,
      "new_path": "test/root_path/src/submodule.rs"
    }
  ]
}
