{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreid7hdukskgd7cey3e4vmn7zkkpgthyegxw2e6mnayiigj2xncqjmq",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mnzm3vkhyjk2"
  },
  "path": "/t/separating-fetching-from-building-for-better-security/24390#post_4",
  "publishedAt": "2026-06-11T14:55:41.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "rust-analyzer-master/crates/project-model/src/sysroot.rs:369"
  ],
  "textContent": "bjorn3:\n\n> Why is the `__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS=nightly` necessary? None of the arguments you passed are unstable.\n\nI was surprised that rust-analzyer fetches dependencies of the stdlib (and not just of the project being analyzed). I naively assumed that rustup already installs everything that is needed for using the stdlib. It turns out that it installs everything that is needed for building with the stdlib, but not for rust-analyzing it. (Or at least this is my understanding.)\n\nSince I was getting warnings about the wrapped rust-analyzer not being able to fetch what it needs, I added code that tries to emulate what rust-analyzer itself does. I took the above from rust-analyzer-master/crates/project-model/src/sysroot.rs:369\n\n\n      let mut cargo_config = cargo_config.clone();\n      // the sysroot uses `public-dependency`, so we make cargo think it's a nightly\n      cargo_config.extra_env.insert(\n          \"__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS\".to_owned(),\n          Some(\"nightly\".to_owned()),\n      );\n\n\nI do not claim to have a deep understanding of the involved mechanisms, but it seems to work at least in my testing.\n\nIn any way, whether `__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS=nightly` should be set or not is not my main point.",
  "title": "Separating fetching from building for better security"
}