Skip to content

Commit 1a2b90b

Browse files
authored
Rollup merge of #87255 - RalfJung:miri-test-libcore, r=Mark-Simulacrum
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!
2 parents aca83f1 + 6cba798 commit 1a2b90b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

library/alloc/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
//! [`Rc`]: rc
5757
//! [`RefCell`]: core::cell
5858
59+
// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be
60+
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
61+
// rustc itself never sets the feature, so this line has no affect there.
62+
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
5963
#![allow(unused_attributes)]
6064
#![stable(feature = "alloc", since = "1.36.0")]
6165
#![doc(

library/core/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
//
5050
// This cfg won't affect doc tests.
5151
#![cfg(not(test))]
52+
// To run libcore tests without x.py without ending up with two copies of libcore, Miri needs to be
53+
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
54+
// rustc itself never sets the feature, so this line has no affect there.
55+
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
5256
#![stable(feature = "core", since = "1.6.0")]
5357
#![doc(
5458
html_playground_url = "https://play.rust-lang.org/",

0 commit comments

Comments
 (0)