)]}'
{
  "commit": "804e419ed85bbcaf99d1a3385cfef3bf3105cd05",
  "tree": "7ee01062e51b3ce3066607c76b29810430254844",
  "parents": [
    "36ba2c7712052d731a7082d0eba5ed3d9d56c133"
  ],
  "author": {
    "name": "Nicholas Nethercote",
    "email": "n.nethercote@gmail.com",
    "time": "Wed Apr 22 13:44:43 2026 +1000"
  },
  "committer": {
    "name": "Nicholas Nethercote",
    "email": "n.nethercote@gmail.com",
    "time": "Fri Apr 24 10:02:13 2026 +1000"
  },
  "message": "Eliminate `CrateMetadataRef`.\n\nThere are a number of things I dislike about `CrateMetadataRef`.\n- It contains two fields `cstore` and `cdata`. The latter points to data\n  within the former. It\u0027s like having an `Elem` type that has a\n  reference to a vec element and also a reference to the vec itself.\n  Weird.\n- The `cdata` field gets a lot of use, and the `Deref` impl just derefs\n  that field. The `cstore` field is rarely used.\n- `CrateMetadataRef` is not a good name.\n- Variables named `cdata` sometimes refer to values of this type and\n  sometimes to values of type `CrateMetadata`, which is confusing.\n\nThe good news is that `CrateMetadataRef` is not necessary and can be\nreplaced with `\u0026CrateMetadata`. Why? Everywhere that `CrateMetadataRef`\nis used, a `TyCtxt` is also present, and the `CStore` is accessible from\nthe `TyCtxt` with `CStore::from_tcx`.\n\nSo this commit removes `CrateMetadataRef` and replaces all its uses with\n`\u0026CrateMetadata`. Notes:\n- This requires adding only two uses of `CStore::from_tcx`, which shows\n  how rarely the `cstore` field was used.\n- `get_crate_data` now matches `get_crate_data_mut` more closely.\n- A few variables are renamed for consistency, e.g. `data`/`cmeta` -\u003e\n  `cdata`.\n- An unnecessary local variable (`local_cdata`) in `decode_expn_id` is\n  removed.\n- All the `CrateMetadataRef` methods become `CrateMetadata` methods, and\n  their receiver changes from `self` to `\u0026self`.\n- `RawDefId::decode_from_cdata` is inlined and removed, because it has a\n  single call site.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "feeb38830e0a930d9827a53890779565ee960076",
      "old_mode": 33188,
      "old_path": "compiler/rustc_metadata/src/creader.rs",
      "new_id": "9a756337335c0039174441eb37a1235d60f6c309",
      "new_mode": 33188,
      "new_path": "compiler/rustc_metadata/src/creader.rs"
    },
    {
      "type": "modify",
      "old_id": "181dbfa126d73ee95ac2d8ee980ba73b9d099415",
      "old_mode": 33188,
      "old_path": "compiler/rustc_metadata/src/rmeta/decoder.rs",
      "new_id": "230ce5686e9798ea089781f0e4409fe0110ed31a",
      "new_mode": 33188,
      "new_path": "compiler/rustc_metadata/src/rmeta/decoder.rs"
    },
    {
      "type": "modify",
      "old_id": "3e63e953e44697f5ba9a18f7e3a8ee3841771a88",
      "old_mode": 33188,
      "old_path": "compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs",
      "new_id": "a00fb59963ac2acd4033e99151b388e97b4d0aa7",
      "new_mode": 33188,
      "new_path": "compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs"
    },
    {
      "type": "modify",
      "old_id": "781d3c6d18372fb3aa848e1c27827ea5571973e3",
      "old_mode": 33188,
      "old_path": "compiler/rustc_metadata/src/rmeta/mod.rs",
      "new_id": "c7b2eaa15ebfb349793fdd5b276163ec536f1925",
      "new_mode": 33188,
      "new_path": "compiler/rustc_metadata/src/rmeta/mod.rs"
    }
  ]
}
