Skip to content

Commit e3d7ee8

Browse files
committed
test(build-std): resolve too less deps
This failed because since 125e873 [`std_resolve`][1] only includes `sysroot` as primary package. When any custom Cargo feature is provided via `-Zbuild-std-feature`, the default feature set `panic-unwind` would be gone, so no `panic_unwind` crate presents in `std_resolve`. When then calling [`std_resolve.query`][2] with the default set of crates from [`std_crates`][3], which automatically includes `panic_unwind` when `std` presents, it'll result in spec not found because `panic_unwind` was not in `std_resolve` anyway. [1]: https://github.com/rust-lang/cargo/blob/addcc8ca715bc7fe20df66afd6efbf3c77ef43f8/src/cargo/core/compiler/standard_lib.rs#L96 [2]: https://github.com/rust-lang/cargo/blob/addcc8ca715bc7fe20df66afd6efbf3c77ef43f8/src/cargo/core/compiler/standard_lib.rs#L158 [3]: https://github.com/rust-lang/cargo/blob/addcc8ca715bc7fe20df66afd6efbf3c77ef43f8/src/cargo/core/compiler/standard_lib.rs#L156 See #14935
1 parent 2e26bfb commit e3d7ee8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/build-std/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,30 @@ fn test_proc_macro() {
402402
"#]])
403403
.run();
404404
}
405+
406+
#[cargo_test(build_std_real)]
407+
fn test_panic_abort() {
408+
// See rust-lang/cargo#14935
409+
let p = project()
410+
.file(
411+
"Cargo.toml",
412+
r#"
413+
[package]
414+
name = "foo"
415+
edition = "2021"
416+
"#,
417+
)
418+
.file("src/lib.rs", "#![no_std]")
419+
.build();
420+
421+
p.cargo("check")
422+
.build_std_arg("std,panic_abort")
423+
.env("RUSTFLAGS", "-C panic=abort")
424+
.arg("-Zbuild-std-features=panic_immediate_abort")
425+
.with_status(101)
426+
.with_stderr_data(str![[r#"
427+
[ERROR] package ID specification `panic_unwind` did not match any packages
428+
429+
"#]])
430+
.run();
431+
}

0 commit comments

Comments
 (0)