Commit 8c133af
authored
Isolate build script metadata progation between std and non-std crates (#16489)
### What does this PR try to resolve?
This PR fixes a regression found in
rust-lang/rust#150739 that was introduced in
#16436.
For `-Zbuild-std` std dependencies, we would panic due to the dependency
not being present in `Cargo.toml`.
~~This PR adds handling fallback to the `unit.pkg.name()` if the unit
both not present in `Cargo.toml` and `is_std`.~~ (see
#16489 (comment))
This PR ensures that metadata propagation is only allowed between
`std->std` crates and `non-std->non-std` crates.
### How to test and review this PR?
```
cargo new foo
cd foo
cargo add cortex-m
cargo -Zbuild-std build
```
Previously we panic with
```
thread 'main' (4072127) panicked at src/cargo/core/compiler/custom_build.rs:472:21:
Dependency `compiler_builtins` not found in `foo`s dependencies
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
with this change we not compile successfully
r? @weihanglo1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
463 | 468 | | |
464 | 469 | | |
465 | 470 | | |
| |||
0 commit comments