Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use MIRI_DEFAULT_ARGS to compile host crates #1761

Merged
merged 1 commit into from Apr 8, 2021
Merged

Don't use MIRI_DEFAULT_ARGS to compile host crates #1761

merged 1 commit into from Apr 8, 2021

Conversation

ghost
Copy link

@ghost ghost commented Apr 7, 2021

They (specifically, --cfg=miri) may cause procedural macros (and probably build scripts) to depend on Miri-only symbols, such as miri_resolve_frame.

This PR makes miri detect host crates inspecting the value of the MIRI_BE_RUSTC environment variable (target -> target crate, host -> host crate, other -> panic) and skip the insertion of MIRI_DEFAULT_ARGS if it's a host crate.

Fixes #1760

src/bin/miri.rs Outdated Show resolved Hide resolved
src/bin/miri.rs Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Apr 7, 2021

run-pass/concurrency/libc_pthread_cond.rs:

thread 'rustc' panicked at 'no callback found', src/thread.rs:714:55
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: core::option::Option<T>::expect
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/option.rs:349:21
   4: miri::thread::EvalContextExt::run_timeout_callback
             at ./src/thread.rs:714:13
   5: miri::eval::eval_main::{{closure}}
             at ./src/eval.rs:230:21
   6: miri::eval::eval_main
             at ./src/eval.rs:218:38
   7: <miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis::{{closure}}
             at ./src/bin/miri.rs:53:40
   8: rustc_interface::passes::QueryContext::enter::{{closure}}
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/compiler/rustc_interface/src/passes.rs:755:42
   9: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/compiler/rustc_middle/src/ty/context.rs:1726:50
  10: rustc_middle::ty::context::tls::set_tlv
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/compiler/rustc_middle/src/ty/context.rs:1710:9
  11: rustc_middle::ty::context::tls::enter_context
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/compiler/rustc_middle/src/ty/context.rs:1726:9
  12: rustc_interface::passes::QueryContext::enter
             at /Users/runner/.rustup/toolchains/master/lib/rustlib/src/rust/compiler/rustc_interface/src/passes.rs:755:9
  13: <miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis
             at ./src/bin/miri.rs:35:9
  14: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  15: rustc_span::with_source_map
  16: rustc_interface::interface::create_compiler_and_run
  17: scoped_tls::ScopedKey<T>::set

https://github.com/rust-lang/miri/runs/2289905504

🤔

@ghost
Copy link
Author

ghost commented Apr 7, 2021

That looks like a strange timer issue... I don't think it's related to this PR though.

@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2021

It somehow managed to trigger this line

this.machine.threads.get_ready_callback().expect("no callback found");

That... should not be possible? We have some non-determinism somewhere...

src/bin/miri.rs Outdated Show resolved Hide resolved
src/bin/miri.rs Outdated Show resolved Hide resolved
test-cargo-miri/build.rs Outdated Show resolved Hide resolved
test-cargo-miri/build.rs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

RalfJung commented Apr 8, 2021

This is great, thanks a lot. :-)
Can you squash the commits together a bit? Then I'll land it.

@ghost
Copy link
Author

ghost commented Apr 8, 2021

Squashed. 🚀

@RalfJung
Copy link
Member

RalfJung commented Apr 8, 2021

@bors r+
🚢

@bors
Copy link
Collaborator

bors commented Apr 8, 2021

📌 Commit 3dff1d4 has been approved by RalfJung

@bors
Copy link
Collaborator

bors commented Apr 8, 2021

⌛ Testing commit 3dff1d4 with merge 1ec52ab...

@bors
Copy link
Collaborator

bors commented Apr 8, 2021

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 1ec52ab to master...

@bors bors merged commit 1ec52ab into rust-lang:master Apr 8, 2021
@ghost ghost deleted the build-rs-proc-macro-no-default-args branch April 8, 2021 17:42
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2021
update Miri

Let's ship rust-lang/miri#1761.
Cc `@rust-lang/miri` r? `@ghost`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined symbol: miri_resolve_frame
2 participants