Skip to content

Commit ac66baa

Browse files
committed
add miri-test-libstd support to libstd
1 parent 8064a49 commit ac66baa

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

library/alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
6161
// rustc itself never sets the feature, so this line has no affect there.
6262
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
63+
//
6364
#![allow(unused_attributes)]
6465
#![stable(feature = "alloc", since = "1.36.0")]
6566
#![doc(

library/std/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@
187187
//! [rust-discord]: https://discord.gg/rust-lang
188188
//! [array]: prim@array
189189
//! [slice]: prim@slice
190+
191+
// To run libstd tests without x.py without ending up with two copies of libstd, Miri needs to be
192+
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
193+
// rustc itself never sets the feature, so this line has no affect there.
194+
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
195+
// miri-test-libstd also prefers to make std use the sysroot versions of the dependencies.
196+
#![cfg_attr(feature = "miri-test-libstd", feature(rustc_private))]
197+
//
190198
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
191199
#![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))]
192200
#![doc(

0 commit comments

Comments
 (0)