Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build-std): always link to std when testing proc-macros (#14850)
### What does this PR try to resolve? Fixes #14735 rust-lang/rust#131188 removes libstd.so from sysroot so `cargo test -Zbuild-std` no longer links to it. That results in a "Library not loaded: @rpath/libstd-[HASH].dylib" when testing a proc macro. This is a pretty niche use case, though it can be easily reproduced by running `cargo test -Zbuild-std` in any proc-macro package. Like in [serde-rs/serde](https://github.com/serde-rs/serde/tree/b9dbfcb4ac3b7a663d9efc6eb1387c62302a6fb4) running it would fail. This patch adds a special case that if it is `cargo run/test` against a proc-macro, fill in std dynamic library search path for it. ### How should we test and review this PR? ``` CARGO_RUN_BUILD_STD_TESTS=1 cargo +nightly t --test build-std test_proc_macro ``` or ``` git clone https://github.com/serde-rs/serde cd serde git switch -d b9dbfcb4ac3b7a663d9efc6eb1387c62302a6fb4 cargo +nightly t --test build-std ``` ### Additional information
- Loading branch information