From ac66baad1a9787f60ff86fac125da8176e053dbc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 3 Aug 2022 22:48:12 -0400 Subject: [PATCH] add miri-test-libstd support to libstd --- library/alloc/src/lib.rs | 1 + library/std/src/lib.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 8b6f4054851..a6f3593addc 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -60,6 +60,7 @@ // able to "empty" this crate. See . // 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( diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index a8d6645794a..bbd7041c50b 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -187,6 +187,14 @@ //! [rust-discord]: https://discord.gg/rust-lang //! [array]: prim@array //! [slice]: prim@slice + +// To run libstd tests without x.py without ending up with two copies of libstd, Miri needs to be +// able to "empty" this crate. See . +// rustc itself never sets the feature, so this line has no affect there. +#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))] +// miri-test-libstd also prefers to make std use the sysroot versions of the dependencies. +#![cfg_attr(feature = "miri-test-libstd", feature(rustc_private))] +// #![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))] #![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))] #![doc(