Skip to content

Commit e084680

Browse files
authored
Rollup merge of rust-lang#138082 - thaliaarchi:slice-cfg-not-test, r=thomcc
Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2 parents 199e714 + 638b226 commit e084680

File tree

34 files changed

+90
-127
lines changed

34 files changed

+90
-127
lines changed

compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From ad7ffe71baba46865f2e65266ab025920dfdc20b Mon Sep 17 00:00:00 2001
1+
From 5d7c709608b01301d4628d2159265936d4440b67 Mon Sep 17 00:00:00 2001
22
From: bjorn3 <bjorn3@users.noreply.github.com>
33
Date: Thu, 18 Feb 2021 18:45:28 +0100
44
Subject: [PATCH] Disable 128bit atomic operations
@@ -7,11 +7,10 @@ Cranelift doesn't support them yet
77
---
88
library/core/src/panic/unwind_safe.rs | 6 -----
99
library/core/src/sync/atomic.rs | 38 ---------------------------
10-
library/core/tests/atomic.rs | 4 ---
11-
4 files changed, 4 insertions(+), 50 deletions(-)
10+
2 files changed, 44 deletions(-)
1211

1312
diff --git a/library/core/src/panic/unwind_safe.rs b/library/core/src/panic/unwind_safe.rs
14-
index 092b7cf..158cf71 100644
13+
index a60f0799c0e..af056fbf41f 100644
1514
--- a/library/core/src/panic/unwind_safe.rs
1615
+++ b/library/core/src/panic/unwind_safe.rs
1716
@@ -216,9 +216,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicI32 {}
@@ -21,7 +20,7 @@ index 092b7cf..158cf71 100644
2120
-#[cfg(target_has_atomic_load_store = "128")]
2221
-#[unstable(feature = "integer_atomics", issue = "99069")]
2322
-impl RefUnwindSafe for crate::sync::atomic::AtomicI128 {}
24-
23+
2524
#[cfg(target_has_atomic_load_store = "ptr")]
2625
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
2726
@@ -235,9 +232,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicU32 {}
@@ -31,14 +30,14 @@ index 092b7cf..158cf71 100644
3130
-#[cfg(target_has_atomic_load_store = "128")]
3231
-#[unstable(feature = "integer_atomics", issue = "99069")]
3332
-impl RefUnwindSafe for crate::sync::atomic::AtomicU128 {}
34-
33+
3534
#[cfg(target_has_atomic_load_store = "8")]
3635
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
3736
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
38-
index d9de37e..8293fce 100644
37+
index bf2b6d59f88..d5ccce03bbf 100644
3938
--- a/library/core/src/sync/atomic.rs
4039
+++ b/library/core/src/sync/atomic.rs
41-
@@ -2996,44 +2996,6 @@ atomic_int! {
40+
@@ -3585,44 +3585,6 @@ pub const fn as_ptr(&self) -> *mut $int_type {
4241
8,
4342
u64 AtomicU64
4443
}
@@ -54,7 +53,7 @@ index d9de37e..8293fce 100644
5453
- unstable(feature = "integer_atomics", issue = "99069"),
5554
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
5655
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
57-
- cfg_attr(not(test), rustc_diagnostic_item = "AtomicI128"),
56+
- rustc_diagnostic_item = "AtomicI128",
5857
- "i128",
5958
- "#![feature(integer_atomics)]\n\n",
6059
- atomic_min, atomic_max,
@@ -73,7 +72,7 @@ index d9de37e..8293fce 100644
7372
- unstable(feature = "integer_atomics", issue = "99069"),
7473
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
7574
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
76-
- cfg_attr(not(test), rustc_diagnostic_item = "AtomicU128"),
75+
- rustc_diagnostic_item = "AtomicU128",
7776
- "u128",
7877
- "#![feature(integer_atomics)]\n\n",
7978
- atomic_umin, atomic_umax,
@@ -83,7 +82,6 @@ index d9de37e..8293fce 100644
8382

8483
#[cfg(target_has_atomic_load_store = "ptr")]
8584
macro_rules! atomic_int_ptr_sized {
86-
( $($target_pointer_width:literal $align:literal)* ) => { $(
87-
--
88-
2.26.2.7.g19db9cfb68
85+
--
86+
2.48.1
8987

library/core/src/any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ use crate::{fmt, hash, intrinsics};
109109
// unsafe traits and unsafe methods (i.e., `type_id` would still be safe to call,
110110
// but we would likely want to indicate as such in documentation).
111111
#[stable(feature = "rust1", since = "1.0.0")]
112-
#[cfg_attr(not(test), rustc_diagnostic_item = "Any")]
112+
#[rustc_diagnostic_item = "Any"]
113113
pub trait Any: 'static {
114114
/// Gets the `TypeId` of `self`.
115115
///

library/core/src/array/ascii.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::ascii;
22

3-
#[cfg(not(test))]
43
impl<const N: usize> [u8; N] {
54
/// Converts this array of bytes into an array of ASCII characters,
65
/// or returns `None` if any of the characters is non-ASCII.

library/core/src/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl bool {
5656
/// ```
5757
#[doc(alias = "then_with")]
5858
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
59-
#[cfg_attr(not(test), rustc_diagnostic_item = "bool_then")]
59+
#[rustc_diagnostic_item = "bool_then"]
6060
#[inline]
6161
pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
6262
if self { Some(f()) } else { None }

library/core/src/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub use once::OnceCell;
304304
/// ```
305305
///
306306
/// See the [module-level documentation](self) for more.
307-
#[cfg_attr(not(test), rustc_diagnostic_item = "Cell")]
307+
#[rustc_diagnostic_item = "Cell"]
308308
#[stable(feature = "rust1", since = "1.0.0")]
309309
#[repr(transparent)]
310310
#[rustc_pub_transparent]
@@ -725,7 +725,7 @@ impl<T, const N: usize> Cell<[T; N]> {
725725
/// A mutable memory location with dynamically checked borrow rules
726726
///
727727
/// See the [module-level documentation](self) for more.
728-
#[cfg_attr(not(test), rustc_diagnostic_item = "RefCell")]
728+
#[rustc_diagnostic_item = "RefCell"]
729729
#[stable(feature = "rust1", since = "1.0.0")]
730730
pub struct RefCell<T: ?Sized> {
731731
borrow: Cell<BorrowFlag>,

library/core/src/char/methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ impl char {
11781178
#[must_use]
11791179
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
11801180
#[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")]
1181-
#[cfg_attr(not(test), rustc_diagnostic_item = "char_is_ascii")]
1181+
#[rustc_diagnostic_item = "char_is_ascii"]
11821182
#[inline]
11831183
pub const fn is_ascii(&self) -> bool {
11841184
*self as u32 <= 0x7F

library/core/src/cmp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ pub macro PartialOrd($item:item) {
14811481
#[inline]
14821482
#[must_use]
14831483
#[stable(feature = "rust1", since = "1.0.0")]
1484-
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_min")]
1484+
#[rustc_diagnostic_item = "cmp_min"]
14851485
pub fn min<T: Ord>(v1: T, v2: T) -> T {
14861486
v1.min(v2)
14871487
}
@@ -1573,7 +1573,7 @@ pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
15731573
#[inline]
15741574
#[must_use]
15751575
#[stable(feature = "rust1", since = "1.0.0")]
1576-
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_max")]
1576+
#[rustc_diagnostic_item = "cmp_max"]
15771577
pub fn max<T: Ord>(v1: T, v2: T) -> T {
15781578
v1.max(v2)
15791579
}

library/core/src/convert/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub const fn identity<T>(x: T) -> T {
214214
/// is_hello(s);
215215
/// ```
216216
#[stable(feature = "rust1", since = "1.0.0")]
217-
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")]
217+
#[rustc_diagnostic_item = "AsRef"]
218218
pub trait AsRef<T: ?Sized> {
219219
/// Converts this type into a shared reference of the (usually inferred) input type.
220220
#[stable(feature = "rust1", since = "1.0.0")]
@@ -365,7 +365,7 @@ pub trait AsRef<T: ?Sized> {
365365
/// Note, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or
366366
/// `&mut Vec<u8>`, for example, is the better choice (callers need to pass the correct type then).
367367
#[stable(feature = "rust1", since = "1.0.0")]
368-
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")]
368+
#[rustc_diagnostic_item = "AsMut"]
369369
pub trait AsMut<T: ?Sized> {
370370
/// Converts this type into a mutable reference of the (usually inferred) input type.
371371
#[stable(feature = "rust1", since = "1.0.0")]

library/core/src/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ use crate::ascii::Char as AsciiChar;
101101
/// bar: f32,
102102
/// }
103103
/// ```
104-
#[cfg_attr(not(test), rustc_diagnostic_item = "Default")]
104+
#[rustc_diagnostic_item = "Default"]
105105
#[stable(feature = "rust1", since = "1.0.0")]
106106
#[rustc_trivial_field_reads]
107107
pub trait Default: Sized {

library/core/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use crate::fmt::{self, Debug, Display, Formatter};
4747
/// impl Error for ReadConfigError {}
4848
/// ```
4949
#[stable(feature = "rust1", since = "1.0.0")]
50-
#[cfg_attr(not(test), rustc_diagnostic_item = "Error")]
50+
#[rustc_diagnostic_item = "Error"]
5151
#[rustc_has_incoherent_inherent_impls]
5252
#[allow(multiple_supertrait_upcastable)]
5353
pub trait Error: Debug + Display {

0 commit comments

Comments
 (0)