Skip to content

fix build.rs invoking RUSTC to do check builds#2436

Merged
bors merged 3 commits into
rust-lang:masterfrom
RalfJung:lib-crates
Jul 25, 2022
Merged

fix build.rs invoking RUSTC to do check builds#2436
bors merged 3 commits into
rust-lang:masterfrom
RalfJung:lib-crates

Conversation

@RalfJung

@RalfJung RalfJung commented Jul 24, 2022

Copy link
Copy Markdown
Member

This makes the Miri driver, when invokved via the RUSTC env var from inside a build script, behave almost entirely like rustc. I had to redo how we propagate sysroot information for this (which is actually back to how we used to do sysroot propagation many years ago).

Fixes #2431

Comment thread test-cargo-miri/build.rs Outdated
println!("cargo:rerun-if-env-changed=MIRITESTVAR");
println!("cargo:rustc-env=MIRITESTVAR=testval");

// Test that autocfg works.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably this is testing cargo-miri build script support so having this in test-cargo-miri is the right place IMO.

Comment thread src/bin/miri.rs Outdated
@RalfJung

Copy link
Copy Markdown
Member Author

Oh interesting, this fails in cross-mode. That is probably a problem even before the recent RUSTC changes, but would be nice to find a way to fix it...

@RalfJung

Copy link
Copy Markdown
Member Author

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Jul 24, 2022
@RalfJung

Copy link
Copy Markdown
Member Author

Ah, the problem is that it uses the wrong sysroot. That's why we usually forward rustc invocations through cargo-miri -- it adjusts the sysroot.

I had to completely redo the way we manage the sysroot for this, but now it should be working.

@RalfJung RalfJung changed the title only perform interpretation in binary crates fix build.rs invoking RUSTC to do check builds Jul 24, 2022
this requires a change in sysroot handling: miri driver now requires
MIRI_SYSROOT to be set when it is in 'target' mode, rather than relying on
`--sysroot` always being present.
@RalfJung

Copy link
Copy Markdown
Member Author

Okay this is now quite different from where it started, and also works much better. I have updated the PR title and description accordingly.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Jul 24, 2022
@oli-obk

oli-obk commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

Oooh you figured out the env var dance with unsetting for recursive cases. I gave up on that. I should make a graph of what invokes what some day...

@oli-obk

oli-obk commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

📌 Commit 9406b6d has been approved by oli-obk

It is now in the queue for this repository.

@bors

bors commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 9406b6d with merge 3d237be...

@bors

bors commented Jul 25, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 3d237be to master...

@bors bors merged commit 3d237be into rust-lang:master Jul 25, 2022
@RalfJung RalfJung deleted the lib-crates branch July 25, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Waiting for a review to complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autocfg assumes there is no std

4 participants