Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 408e6b7

Browse files
weihangloantoniospg
authored andcommittedSep 8, 2024
fix: std Cargo.lock moved to library dir
rust-lang#14358 didn't check the correct Cargo.lock existence Perhaps it was there so the test passed, but after a new nightly is out it is gone. ``` Blocking waiting for file lock on package cache error: "/home/user/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try: rustup component add rust-src --toolchain nightly-aarch64-apple-darwin note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
1 parent 0cef0ca commit 408e6b7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎src/cargo/core/compiler/standard_lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn resolve_std<'gctx>(
7373
}
7474

7575
let src_path = detect_sysroot_src_path(target_data)?;
76-
let std_ws_manifest_path = src_path.join("library").join("Cargo.toml");
76+
let std_ws_manifest_path = src_path.join("Cargo.toml");
7777
let gctx = ws.gctx();
7878
// TODO: Consider doing something to enforce --locked? Or to prevent the
7979
// lock file from being written, such as setting ephemeral.
@@ -192,7 +192,8 @@ fn detect_sysroot_src_path(target_data: &RustcTargetData<'_>) -> CargoResult<Pat
192192
.join("lib")
193193
.join("rustlib")
194194
.join("src")
195-
.join("rust");
195+
.join("rust")
196+
.join("library");
196197
let lock = src_path.join("Cargo.lock");
197198
if !lock.exists() {
198199
let msg = format!(

‎tests/testsuite/standard_lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn setup() -> Setup {
132132
fn enable_build_std(e: &mut Execs, setup: &Setup) {
133133
// First up, force Cargo to use our "mock sysroot" which mimics what
134134
// libstd looks like upstream.
135-
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/testsuite/mock-std");
135+
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/testsuite/mock-std/library");
136136
e.env("__CARGO_TESTS_ONLY_SRC_ROOT", &root);
137137

138138
e.masquerade_as_nightly_cargo(&["build-std"]);

0 commit comments

Comments
 (0)
Please sign in to comment.