Skip to content

Commit fbcdf2a

Browse files
committed
clarify lib.rs attribute structure
1 parent 438e49c commit fbcdf2a

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

library/alloc/src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@
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))]
63-
//
6459
#![allow(unused_attributes)]
6560
#![stable(feature = "alloc", since = "1.36.0")]
6661
#![doc(
@@ -78,6 +73,10 @@
7873
))]
7974
#![no_std]
8075
#![needs_allocator]
76+
// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be
77+
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
78+
// rustc itself never sets the feature, so this line has no affect there.
79+
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
8180
//
8281
// Lints:
8382
#![deny(unsafe_op_in_unsafe_fn)]

library/std/src/lib.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,6 @@
188188
//! [array]: prim@array
189189
//! [slice]: prim@slice
190190
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-
//
198191
#![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
199192
#![cfg_attr(feature = "restricted-std", unstable(feature = "restricted_std", issue = "none"))]
200193
#![doc(
@@ -209,25 +202,35 @@
209202
no_global_oom_handling,
210203
not(no_global_oom_handling)
211204
))]
205+
// To run libstd tests without x.py without ending up with two copies of libstd, Miri needs to be
206+
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
207+
// rustc itself never sets the feature, so this line has no affect there.
208+
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
209+
// miri-test-libstd also prefers to make std use the sysroot versions of the dependencies.
210+
#![cfg_attr(feature = "miri-test-libstd", feature(rustc_private))]
212211
// Don't link to std. We are std.
213212
#![no_std]
213+
// Tell the compiler to link to either panic_abort or panic_unwind
214+
#![needs_panic_runtime]
215+
//
216+
// Lints:
214217
#![warn(deprecated_in_future)]
215218
#![warn(missing_docs)]
216219
#![warn(missing_debug_implementations)]
217220
#![allow(explicit_outlives_requirements)]
218221
#![allow(unused_lifetimes)]
219-
// Tell the compiler to link to either panic_abort or panic_unwind
220-
#![needs_panic_runtime]
222+
#![deny(rustc::existing_doc_keyword)]
221223
// Ensure that std can be linked against panic_abort despite compiled with `-C panic=unwind`
222224
#![deny(ffi_unwind_calls)]
223225
// std may use features in a platform-specific way
224226
#![allow(unused_features)]
227+
//
228+
// Features:
225229
#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count, rt))]
226230
#![cfg_attr(
227231
all(target_vendor = "fortanix", target_env = "sgx"),
228232
feature(slice_index_methods, coerce_unsized, sgx_platform)
229233
)]
230-
#![deny(rustc::existing_doc_keyword)]
231234
//
232235
// Language features:
233236
#![feature(alloc_error_handler)]

0 commit comments

Comments
 (0)