Skip to content

Commit

Permalink
Rollup merge of #87255 - RalfJung:miri-test-libcore, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
better support for running libcore tests with Miri

See rust-lang/miri-test-libstd#4 for a description of the problem that this fixes.
Thanks to `@hyd-dev` for suggesting this patch!
  • Loading branch information
JohnTitor authored Jul 23, 2021
2 parents aca83f1 + 6cba798 commit 1a2b90b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
//! [`Rc`]: rc
//! [`RefCell`]: core::cell

// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
// rustc itself never sets the feature, so this line has no affect there.
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
#![allow(unused_attributes)]
#![stable(feature = "alloc", since = "1.36.0")]
#![doc(
Expand Down
4 changes: 4 additions & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
//
// This cfg won't affect doc tests.
#![cfg(not(test))]
// To run libcore tests without x.py without ending up with two copies of libcore, Miri needs to be
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
// rustc itself never sets the feature, so this line has no affect there.
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
#![stable(feature = "core", since = "1.6.0")]
#![doc(
html_playground_url = "https://play.rust-lang.org/",
Expand Down

0 comments on commit 1a2b90b

Please sign in to comment.