Skip to content

Regression build script output collision when using unstable target-applies-to-host and debug=0 #14394

@erikjohnston

Description

@erikjohnston

Problem

cargo check and co. fail to build the project with the error below. It does not fail with older nightlies.

thread '<unnamed>' panicked at src/cargo/core/compiler/custom_build.rs:1266:39:yn, anyhow(build), memchr                        
build script output collision for anyhow v1.0.86/4f7f6ef5a5e5df20
old=BuildOutput { library_paths: [], library_links: [], linker_args: [], cfgs: ["std_backtrace", "error_generic_member_access"], check_cfgs: ["cfg(anyhow_nightly_testing)", "cfg(anyhow_no_fmt_arguments_as_str)", "cfg(anyhow_no_ptr_addr_of)", "cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)", "cfg(doc_cfg)", "cfg(error_generic_member_access)", "cfg(std_backtrace)"], env: [], metadata: [], rerun_if_changed: ["build/probe.rs"], rerun_if_env_changed: [], warnings: [] }
new=BuildOutput { library_paths: [], library_links: [], linker_args: [], cfgs: ["std_backtrace", "error_generic_member_access"], check_cfgs: ["cfg(anyhow_nightly_testing)", "cfg(anyhow_no_fmt_arguments_as_str)", "cfg(anyhow_no_ptr_addr_of)", "cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)", "cfg(doc_cfg)", "cfg(error_generic_member_access)", "cfg(std_backtrace)"], env: [], metadata: [], rerun_if_changed: ["build/probe.rs"], rerun_if_env_changed: [], warnings: [] }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/cargo/core/compiler/job_queue/mod.rs:971:64:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Steps

  1. Checkout https://github.com/erikjohnston/cargo-regression-repro
  2. Use a nightly version (e.g. nightly 2024-08-09)
  3. Run cargo check

That is a minimum example, I ran into this error while trying to compile matrix-org/matrix-rust-sdk@5954ee1

Possible Solution(s)

No response

Notes

This regressed in toolchain nightly-2024-07-08, and rustc commit rust-lang/rust@20ae37c. This PR got pulled in, which touches target-applies-to-host: #13900, though I haven't actually checked it is that PR.

I don't really understand what target-applies-to-host is doing, so this may just be a silly combination of flags 🤷

Version

cargo 1.82.0-nightly (0d8d22f83 2024-08-08)
release: 1.82.0-nightly
commit-hash: 0d8d22f83b066503f6b2b755925197e959e58b4f
commit-date: 2024-08-08
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/3.3.1)
ssl: OpenSSL 3.3.1 4 Jun 2024
os: Ubuntu 22.4.0 (jammy) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Z-target-applies-to-hostNightly: target-applies-to-host

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions