Skip to content

Bad .rustc_info.json caused nightly cargo to use beta rustc #9500

@CAD97

Description

@CAD97

Problem

With a stale .rustc_info.json, I observed that D:\.rust\rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe build --release --target-dir D:\path\to\target\dir failed, reporting error[E0554]: `#![feature]` may not be used on the beta release channel. Omitting the --target-dir allows the project to compile cleanly in the default target directory. Additionally, deleting the .rustc_info.json allowed compilation to succeed.

Steps

  • Create a cargo workspace, and add some #![feature(..)] attribute to it.
  • $RUSTUP_HOME/toolchains/beta-x86_64-pc-windows-msvc\bin\cargo.exe build --target-dir ./target
    • expected: error[E0554]: `#![feature]` may not be used on the beta release channel
  • $RUSTUP_HOME/toolchains/nightly-x86_64-pc-windows-msvc\bin\cargo.exe build --target-dir ./target
    • unexpected: error[E0554]: `#![feature]` may not be used on the beta release channel
Original information

I have no idea whether this will reproduce on another machine. Building with the bad .rustc_info.json in place on my machine consistently produces the error if (and only if) the build isn't fresh.

Bad .rustc_info.json
{
  "rustc_fingerprint": 3894061304317293000,
  "outputs": {
    "2797684049618456168": {
      "success": false,
      "status": "exit code: 1",
      "code": 1,
      "stdout": "",
      "stderr": "error: `-Csplit-debuginfo` is unstable on this platform\n\n"
    },
    "931469667778813386": {
      "success": true,
      "status": "",
      "code": 0,
      "stdout": "___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nD:\\.rust\\rustup\\toolchains\\beta-x86_64-pc-windows-msvc\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n",
      "stderr": ""
    },
    "17598535894874457435": {
      "success": true,
      "status": "",
      "code": 0,
      "stdout": "rustc 1.54.0-nightly (79e50bf77 2021-05-10)\nbinary: rustc\ncommit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062\ncommit-date: 2021-05-10\nhost: x86_64-pc-windows-msvc\nrelease: 1.54.0-nightly\nLLVM version: 12.0.1\n",
      "stderr": ""
    }
  },
  "successes": {}
}
Clean generated .rustc_info.json
{
  "rustc_fingerprint": 3894061304317293000,
  "outputs": {
    "17598535894874457435": {
      "success": true,
      "status": "",
      "code": 0,
      "stdout": "rustc 1.54.0-nightly (79e50bf77 2021-05-10)\nbinary: rustc\ncommit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062\ncommit-date: 2021-05-10\nhost: x86_64-pc-windows-msvc\nrelease: 1.54.0-nightly\nLLVM version: 12.0.1\n",
      "stderr": ""
    },
    "2797684049618456168": {
      "success": false,
      "status": "exit code: 1",
      "code": 1,
      "stdout": "",
      "stderr": "error: `-Csplit-debuginfo` is unstable on this platform\n\n"
    },
    "931469667778813386": {
      "success": true,
      "status": "",
      "code": 0,
      "stdout": "___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nD:\\.rust\\rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"pc\"\nwindows\n",
      "stderr": ""
    }
  },
  "successes": {}
}

Notes

No rustup override is present in either the working nor the target directory. Beta is my default toolchain. (I'm attempting to integrate Rust into a larger C++ compilation environment, thus I'm not sure the exact sequence of cargo/rustc versions that got used while hacking on this.)

Beta version: cargo 1.53.0-beta (4369396ce 2021-04-27) / rustc 1.54.0-nightly (79e50bf77 2021-05-10)
Nightly version: cargo 1.54.0-nightly (e51522ab3 2021-05-07) / rustc 1.54.0-nightly (79e50bf77 2021-05-10)

This was done with $env:CARGO_INCREMENTAL=0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cachingArea: caching of dependencies, repositories, and build artifactsA-rustupArea: rustup interactionC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions