-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Closed
Copy link
Labels
A-gitArea: anything dealing with gitArea: anything dealing with gitC-bugCategory: bugCategory: bugCommand-vendorS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.regression-from-stable-to-stableRegression in stable that worked in a previous stable release.Regression in stable that worked in a previous stable release.
Description
Problem
In Rust 1.79 and older releases, cargo vendor
used to work for crates that have build scripts applying only to their source repo, and not published to crates.io. An example of such a crate is https://github.com/dtolnay/cxx/blob/1.0.124/macro/Cargo.toml#L8. The build script was correctly omitted from being vendored.
Since Rust 1.80, Cargo still does not vendor the build script, but now it inserts build = "build.rs"
into the vendored Cargo.toml, which causes compilation of the vendored sources to fail.
Steps
Create an empty project with this Cargo manifest:
# Cargo.toml
[package]
name = "repro"
version = "0.0.0"
edition = "2021"
publish = false
[dependencies]
cxxbridge-macro = { git = "https://github.com/dtolnay/cxx", tag = "1.0.124" }
$ mkdir .cargo
$ cargo vendor > .cargo/config.toml
$ cargo check
...
Compiling cxxbridge-macro v1.0.124 (https://github.com/dtolnay/cxx?tag=1.0.124#afd4aa3f)
error: couldn't read /path/to/vendor/vendor/cxxbridge-macro/build.rs: No such file or directory (os error 2)
error: could not compile `cxxbridge-macro` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Possible Solution(s)
Do not inject build = "build.rs"
into the vendored manifest if build.rs is not being vendored.
Notes
Bisects to 1e60477.
Version
No response
Metadata
Metadata
Assignees
Labels
A-gitArea: anything dealing with gitArea: anything dealing with gitC-bugCategory: bugCategory: bugCommand-vendorS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.regression-from-stable-to-stableRegression in stable that worked in a previous stable release.Regression in stable that worked in a previous stable release.