Skip to content

Commit ddbbded

Browse files
authored
Merge pull request rust-lang#130 from bjorn3/rustup
Rustup to rustc 1.61.0-nightly (4b043fa 2022-02-24)
2 parents 164aa39 + d565f60 commit ddbbded

File tree

6 files changed

+238
-26
lines changed

6 files changed

+238
-26
lines changed

patches/0024-core-Disable-portable-simd-test.patch

Lines changed: 216 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,230 @@ Subject: [PATCH] [core] Disable portable-simd test
77
library/core/tests/lib.rs | 1 -
88
1 file changed, 1 deletion(-)
99

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
10176
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
11-
index ec70034..7cd9e21 100644
177+
index 06c7be0..359e2e7 100644
12178
--- a/library/core/tests/lib.rs
13179
+++ 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;
16190
mod ptr;
17191
mod result;
18192
-mod simd;
19193
mod slice;
20194
mod str;
21195
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+
--
23235
2.26.2.7.g19db9cfb68
24236

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2022-01-30"
2+
channel = "nightly-2022-02-25"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/archive.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
113113
Ok(())
114114
}
115115

116-
fn update_symbols(&mut self) {
117-
}
118-
119116
fn build(mut self) {
120117
use std::process::Command;
121118

src/builder.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
390390
bx
391391
}
392392

393-
fn build_sibling_block(&mut self, name: &str) -> Self {
394-
let block = self.append_sibling_block(name);
395-
Self::build(self.cx, block)
396-
}
397-
398393
fn llbb(&self) -> Block<'gcc> {
399394
self.block.expect("block")
400395
}
@@ -409,6 +404,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
409404
func.new_block(name)
410405
}
411406

407+
fn switch_to_block(&mut self, block: Self::BasicBlock) {
408+
*self.cx.current_block.borrow_mut() = Some(block);
409+
self.block = Some(block);
410+
}
411+
412412
fn ret_void(&mut self) {
413413
self.llbb().end_with_void_return(None)
414414
}
@@ -747,28 +747,31 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
747747
let start = dest.project_index(&mut self, zero).llval;
748748
let end = dest.project_index(&mut self, count).llval;
749749

750-
let mut header_bx = self.build_sibling_block("repeat_loop_header");
751-
let mut body_bx = self.build_sibling_block("repeat_loop_body");
752-
let next_bx = self.build_sibling_block("repeat_loop_next");
750+
let header_bb = self.append_sibling_block("repeat_loop_header");
751+
let body_bb = self.append_sibling_block("repeat_loop_body");
752+
let next_bb = self.append_sibling_block("repeat_loop_next");
753753

754754
let ptr_type = start.get_type();
755755
let current = self.llbb().get_function().new_local(None, ptr_type, "loop_var");
756756
let current_val = current.to_rvalue();
757757
self.assign(current, start);
758758

759-
self.br(header_bx.llbb());
759+
self.br(header_bb);
760760

761-
let keep_going = header_bx.icmp(IntPredicate::IntNE, current_val, end);
762-
header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb());
761+
self.switch_to_block(header_bb);
762+
let keep_going = self.icmp(IntPredicate::IntNE, current_val, end);
763+
self.cond_br(keep_going, body_bb, next_bb);
763764

765+
self.switch_to_block(body_bb);
764766
let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
765-
cg_elem.val.store(&mut body_bx, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
767+
cg_elem.val.store(&mut self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
766768

767-
let next = body_bx.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
768-
body_bx.llbb().add_assignment(None, current, next);
769-
body_bx.br(header_bx.llbb());
769+
let next = self.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
770+
self.llbb().add_assignment(None, current, next);
771+
self.br(header_bb);
770772

771-
next_bx
773+
self.switch_to_block(next_bb);
774+
self
772775
}
773776

774777
fn range_metadata(&mut self, _load: RValue<'gcc>, _range: WrappingRange) {

src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
149149
// TODO(antoyo): set link section.
150150
}
151151

152-
if attrs.flags.contains(CodegenFnAttrFlags::USED) {
152+
if attrs.flags.contains(CodegenFnAttrFlags::USED) || attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER) {
153153
self.add_used_global(global.to_rvalue());
154154
}
155155
}

src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLa
5252
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
5353
if !cx.sess().fewer_names() =>
5454
{
55-
let mut name = with_no_trimmed_paths(|| layout.ty.to_string());
55+
let mut name = with_no_trimmed_paths!(layout.ty.to_string());
5656
if let (&ty::Adt(def, _), &Variants::Single { index }) =
5757
(layout.ty.kind(), &layout.variants)
5858
{

0 commit comments

Comments
 (0)