@@ -7,18 +7,230 @@ Subject: [PATCH] [core] Disable portable-simd test
7
7
library/core/tests/lib.rs | 1 -
8
8
1 file changed, 1 deletion(-)
9
9
10
+ diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
11
+ index aa1ad93..95fbf55 100644
12
+ --- a/library/core/src/lib.rs
13
+ +++ b/library/core/src/lib.rs
14
+ @@ -398,25 +398,4 @@ pub mod arch {
15
+ }
16
+ }
17
+
18
+ - // Pull in the `core_simd` crate directly into libcore. The contents of
19
+ - // `core_simd` are in a different repository: rust-lang/portable-simd.
20
+ - //
21
+ - // `core_simd` depends on libcore, but the contents of this module are
22
+ - // set up in such a way that directly pulling it here works such that the
23
+ - // crate uses this crate as its libcore.
24
+ - #[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
25
+ - #[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
26
+ - #[allow(rustdoc::bare_urls)]
27
+ - #[unstable(feature = "portable_simd", issue = "86656")]
28
+ - #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
29
+ - mod core_simd;
30
+ -
31
+ - #[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
32
+ - #[unstable(feature = "portable_simd", issue = "86656")]
33
+ - #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
34
+ - pub mod simd {
35
+ - #[unstable(feature = "portable_simd", issue = "86656")]
36
+ - pub use crate::core_simd::simd::*;
37
+ - }
38
+ -
39
+ include!("primitive_docs.rs");
40
+ diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
41
+ index cd38c3a..ad632dc 100644
42
+ --- a/library/core/src/slice/mod.rs
43
+ +++ b/library/core/src/slice/mod.rs
44
+ @@ -17,7 +17,6 @@ use crate::ptr;
45
+ use crate::result::Result;
46
+ use crate::result::Result::{Err, Ok};
47
+ #[cfg(not(miri))] // Miri does not support all SIMD intrinsics
48
+ - use crate::simd::{self, Simd};
49
+ use crate::slice;
50
+
51
+ #[unstable(
52
+ @@ -3475,123 +3474,6 @@ impl<T> [T] {
53
+ }
54
+ }
55
+
56
+ - /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
57
+ - ///
58
+ - /// This is a safe wrapper around [`slice::align_to`], so has the same weak
59
+ - /// postconditions as that method. You're only assured that
60
+ - /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
61
+ - ///
62
+ - /// Notably, all of the following are possible:
63
+ - /// - `prefix.len() >= LANES`.
64
+ - /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
65
+ - /// - `suffix.len() >= LANES`.
66
+ - ///
67
+ - /// That said, this is a safe method, so if you're only writing safe code,
68
+ - /// then this can at most cause incorrect logic, not unsoundness.
69
+ - ///
70
+ - /// # Panics
71
+ - ///
72
+ - /// This will panic if the size of the SIMD type is different from
73
+ - /// `LANES` times that of the scalar.
74
+ - ///
75
+ - /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
76
+ - /// that from ever happening, as only power-of-two numbers of lanes are
77
+ - /// supported. It's possible that, in the future, those restrictions might
78
+ - /// be lifted in a way that would make it possible to see panics from this
79
+ - /// method for something like `LANES == 3`.
80
+ - ///
81
+ - /// # Examples
82
+ - ///
83
+ - /// ```
84
+ - /// #![feature(portable_simd)]
85
+ - ///
86
+ - /// let short = &[1, 2, 3];
87
+ - /// let (prefix, middle, suffix) = short.as_simd::<4>();
88
+ - /// assert_eq!(middle, []); // Not enough elements for anything in the middle
89
+ - ///
90
+ - /// // They might be split in any possible way between prefix and suffix
91
+ - /// let it = prefix.iter().chain(suffix).copied();
92
+ - /// assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);
93
+ - ///
94
+ - /// fn basic_simd_sum(x: &[f32]) -> f32 {
95
+ - /// use std::ops::Add;
96
+ - /// use std::simd::f32x4;
97
+ - /// let (prefix, middle, suffix) = x.as_simd();
98
+ - /// let sums = f32x4::from_array([
99
+ - /// prefix.iter().copied().sum(),
100
+ - /// 0.0,
101
+ - /// 0.0,
102
+ - /// suffix.iter().copied().sum(),
103
+ - /// ]);
104
+ - /// let sums = middle.iter().copied().fold(sums, f32x4::add);
105
+ - /// sums.horizontal_sum()
106
+ - /// }
107
+ - ///
108
+ - /// let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
109
+ - /// assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);
110
+ - /// ```
111
+ - #[unstable(feature = "portable_simd", issue = "86656")]
112
+ - #[cfg(not(miri))] // Miri does not support all SIMD intrinsics
113
+ - pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T])
114
+ - where
115
+ - Simd<T, LANES>: AsRef<[T; LANES]>,
116
+ - T: simd::SimdElement,
117
+ - simd::LaneCount<LANES>: simd::SupportedLaneCount,
118
+ - {
119
+ - // These are expected to always match, as vector types are laid out like
120
+ - // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
121
+ - // might as well double-check since it'll optimize away anyhow.
122
+ - assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
123
+ -
124
+ - // SAFETY: The simd types have the same layout as arrays, just with
125
+ - // potentially-higher alignment, so the de-facto transmutes are sound.
126
+ - unsafe { self.align_to() }
127
+ - }
128
+ -
129
+ - /// Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.
130
+ - ///
131
+ - /// This is a safe wrapper around [`slice::align_to_mut`], so has the same weak
132
+ - /// postconditions as that method. You're only assured that
133
+ - /// `self.len() == prefix.len() + middle.len() * LANES + suffix.len()`.
134
+ - ///
135
+ - /// Notably, all of the following are possible:
136
+ - /// - `prefix.len() >= LANES`.
137
+ - /// - `middle.is_empty()` despite `self.len() >= 3 * LANES`.
138
+ - /// - `suffix.len() >= LANES`.
139
+ - ///
140
+ - /// That said, this is a safe method, so if you're only writing safe code,
141
+ - /// then this can at most cause incorrect logic, not unsoundness.
142
+ - ///
143
+ - /// This is the mutable version of [`slice::as_simd`]; see that for examples.
144
+ - ///
145
+ - /// # Panics
146
+ - ///
147
+ - /// This will panic if the size of the SIMD type is different from
148
+ - /// `LANES` times that of the scalar.
149
+ - ///
150
+ - /// At the time of writing, the trait restrictions on `Simd<T, LANES>` keeps
151
+ - /// that from ever happening, as only power-of-two numbers of lanes are
152
+ - /// supported. It's possible that, in the future, those restrictions might
153
+ - /// be lifted in a way that would make it possible to see panics from this
154
+ - /// method for something like `LANES == 3`.
155
+ - #[unstable(feature = "portable_simd", issue = "86656")]
156
+ - #[cfg(not(miri))] // Miri does not support all SIMD intrinsics
157
+ - pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])
158
+ - where
159
+ - Simd<T, LANES>: AsMut<[T; LANES]>,
160
+ - T: simd::SimdElement,
161
+ - simd::LaneCount<LANES>: simd::SupportedLaneCount,
162
+ - {
163
+ - // These are expected to always match, as vector types are laid out like
164
+ - // arrays per <https://llvm.org/docs/LangRef.html#vector-type>, but we
165
+ - // might as well double-check since it'll optimize away anyhow.
166
+ - assert_eq!(mem::size_of::<Simd<T, LANES>>(), mem::size_of::<[T; LANES]>());
167
+ -
168
+ - // SAFETY: The simd types have the same layout as arrays, just with
169
+ - // potentially-higher alignment, so the de-facto transmutes are sound.
170
+ - unsafe { self.align_to_mut() }
171
+ - }
172
+ -
173
+ /// Checks if the elements of this slice are sorted.
174
+ ///
175
+ /// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the
10
176
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
11
- index ec70034..7cd9e21 100644
177
+ index 06c7be0..359e2e7 100644
12
178
--- a/library/core/tests/lib.rs
13
179
+++ b/library/core/tests/lib.rs
14
- @@ -121,7 +121,6 @@ mod pattern;
15
- mod pin;
180
+ @@ -75,7 +75,6 @@
181
+ #![feature(never_type)]
182
+ #![feature(unwrap_infallible)]
183
+ #![feature(result_into_ok_or_err)]
184
+ - #![feature(portable_simd)]
185
+ #![feature(ptr_metadata)]
186
+ #![feature(once_cell)]
187
+ #![feature(option_result_contains)]
188
+ @@ -127,7 +126,6 @@ mod pin;
189
+ mod pin_macro;
16
190
mod ptr;
17
191
mod result;
18
192
- mod simd;
19
193
mod slice;
20
194
mod str;
21
195
mod str_lossy;
22
- - -
196
+ diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
197
+ index 5dc586d..b6fc48f 100644
198
+ --- a/library/std/src/lib.rs
199
+ +++ b/library/std/src/lib.rs
200
+ @@ -312,7 +312,6 @@
201
+ #![feature(panic_can_unwind)]
202
+ #![feature(panic_unwind)]
203
+ #![feature(platform_intrinsics)]
204
+ - #![feature(portable_simd)]
205
+ #![feature(prelude_import)]
206
+ #![feature(ptr_as_uninit)]
207
+ #![feature(ptr_internals)]
208
+ @@ -508,25 +508,6 @@ pub mod time;
209
+ #[unstable(feature = "once_cell", issue = "74465")]
210
+ pub mod lazy;
211
+
212
+ - // Pull in `std_float` crate into libstd. The contents of
213
+ - // `std_float` are in a different repository: rust-lang/portable-simd.
214
+ - #[path = "../../portable-simd/crates/std_float/src/lib.rs"]
215
+ - #[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
216
+ - #[allow(rustdoc::bare_urls)]
217
+ - #[unstable(feature = "portable_simd", issue = "86656")]
218
+ - #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
219
+ - mod std_float;
220
+ -
221
+ - #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics
222
+ - #[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
223
+ - #[unstable(feature = "portable_simd", issue = "86656")]
224
+ - pub mod simd {
225
+ - #[doc(inline)]
226
+ - pub use crate::std_float::StdFloat;
227
+ - #[doc(inline)]
228
+ - pub use core::simd::*;
229
+ - }
230
+ -
231
+ #[stable(feature = "futures_api", since = "1.36.0")]
232
+ pub mod task {
233
+ //! Types and Traits for working with asynchronous tasks.
234
+ - -
23
235
2.26.2.7.g19db9cfb68
24
236
0 commit comments