Skip to content

Commit 1746cd8

Browse files
committed
Auto merge of #103188 - JohnTitor:rollup-pwilam1, r=JohnTitor
Rollup of 6 pull requests Successful merges: - #103023 (Adding `fuchsia-ignore` and `needs-unwind` to compiler test cases) - #103142 (Make diagnostic for unsatisfied `Termination` bounds more precise) - #103154 (Fix typo in `ReverseSearcher` docs) - #103159 (Remove the redundant `Some(try_opt!(..))` in `checked_pow`) - #103163 (Remove all uses of array_assume_init) - #103168 (Stabilize asm_sym) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 85bc402 + 412f6f8 commit 1746cd8

File tree

10 files changed

+23
-16
lines changed

10 files changed

+23
-16
lines changed

alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@
125125
#![feature(iter_advance_by)]
126126
#![feature(iter_next_chunk)]
127127
#![feature(layout_for_ptr)]
128-
#![feature(maybe_uninit_array_assume_init)]
129128
#![feature(maybe_uninit_slice)]
130129
#![feature(maybe_uninit_uninit_array)]
130+
#![feature(maybe_uninit_uninit_array_transpose)]
131131
#![cfg_attr(test, feature(new_uninit))]
132132
#![feature(nonnull_slice_from_raw_parts)]
133133
#![feature(pattern)]

alloc/src/vec/into_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
223223

224224
self.ptr = self.ptr.wrapping_byte_add(N);
225225
// Safety: ditto
226-
return Ok(unsafe { MaybeUninit::array_assume_init(raw_ary) });
226+
return Ok(unsafe { raw_ary.transpose().assume_init() });
227227
}
228228

229229
if len < N {
@@ -241,7 +241,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
241241
return unsafe {
242242
ptr::copy_nonoverlapping(self.ptr, raw_ary.as_mut_ptr() as *mut T, N);
243243
self.ptr = self.ptr.add(N);
244-
Ok(MaybeUninit::array_assume_init(raw_ary))
244+
Ok(raw_ary.transpose().assume_init())
245245
};
246246
}
247247

core/src/array/iter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ impl<T, const N: usize> IntoIter<T, N> {
104104
///
105105
/// ```
106106
/// #![feature(array_into_iter_constructors)]
107-
///
108-
/// #![feature(maybe_uninit_array_assume_init)]
107+
/// #![feature(maybe_uninit_uninit_array_transpose)]
109108
/// #![feature(maybe_uninit_uninit_array)]
110109
/// use std::array::IntoIter;
111110
/// use std::mem::MaybeUninit;
@@ -134,7 +133,7 @@ impl<T, const N: usize> IntoIter<T, N> {
134133
/// }
135134
///
136135
/// // SAFETY: We've initialized all N items
137-
/// unsafe { Ok(MaybeUninit::array_assume_init(buffer)) }
136+
/// unsafe { Ok(buffer.transpose().assume_init()) }
138137
/// }
139138
///
140139
/// let r: [_; 4] = next_chunk(&mut (10..16)).unwrap();

core/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ where
912912

913913
mem::forget(guard);
914914
// SAFETY: All elements of the array were populated in the loop above.
915-
let output = unsafe { MaybeUninit::array_assume_init(array) };
915+
let output = unsafe { array.transpose().assume_init() };
916916
Ok(Try::from_output(output))
917917
}
918918

core/src/num/int_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ macro_rules! int_impl {
869869
// Deal with the final bit of the exponent separately, since
870870
// squaring the base afterwards is not necessary and may cause a
871871
// needless overflow.
872-
Some(try_opt!(acc.checked_mul(base)))
872+
acc.checked_mul(base)
873873
}
874874

875875
/// Saturating integer addition. Computes `self + rhs`, saturating at the numeric

core/src/num/uint_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ macro_rules! uint_impl {
990990
// squaring the base afterwards is not necessary and may cause a
991991
// needless overflow.
992992

993-
Some(try_opt!(acc.checked_mul(base)))
993+
acc.checked_mul(base)
994994
}
995995

996996
/// Saturating integer addition. Computes `self + rhs`, saturating at

core/src/str/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub unsafe trait Searcher<'a> {
267267
/// The index ranges returned by this trait are not required
268268
/// to exactly match those of the forward search in reverse.
269269
///
270-
/// For the reason why this trait is marked unsafe, see them
270+
/// For the reason why this trait is marked unsafe, see the
271271
/// parent trait [`Searcher`].
272272
pub unsafe trait ReverseSearcher<'a>: Searcher<'a> {
273273
/// Performs the next search step starting from the back.

core/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
#![feature(slice_from_ptr_range)]
5050
#![feature(split_as_slice)]
5151
#![feature(maybe_uninit_uninit_array)]
52-
#![feature(maybe_uninit_array_assume_init)]
5352
#![feature(maybe_uninit_write_slice)]
53+
#![feature(maybe_uninit_uninit_array_transpose)]
5454
#![feature(min_specialization)]
5555
#![feature(numfmt)]
5656
#![feature(step_trait)]

core/tests/mem.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,18 @@ fn assume_init_good() {
163163

164164
#[test]
165165
fn uninit_array_assume_init() {
166-
let mut array: [MaybeUninit<i16>; 5] = MaybeUninit::uninit_array();
166+
let mut array = [MaybeUninit::<i16>::uninit(); 5];
167167
array[0].write(3);
168168
array[1].write(1);
169169
array[2].write(4);
170170
array[3].write(1);
171171
array[4].write(5);
172172

173-
let array = unsafe { MaybeUninit::array_assume_init(array) };
173+
let array = unsafe { array.transpose().assume_init() };
174174

175175
assert_eq!(array, [3, 1, 4, 1, 5]);
176176

177-
let [] = unsafe { MaybeUninit::<!>::array_assume_init([]) };
177+
let [] = unsafe { [MaybeUninit::<!>::uninit(); 0].transpose().assume_init() };
178178
}
179179

180180
#[test]

std/src/process.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,8 +2154,16 @@ pub fn id() -> u32 {
21542154
#[cfg_attr(not(test), lang = "termination")]
21552155
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
21562156
#[rustc_on_unimplemented(
2157-
message = "`main` has invalid return type `{Self}`",
2158-
label = "`main` can only return types that implement `{Termination}`"
2157+
on(
2158+
all(not(bootstrap), cause = "MainFunctionType"),
2159+
message = "`main` has invalid return type `{Self}`",
2160+
label = "`main` can only return types that implement `{Termination}`"
2161+
),
2162+
on(
2163+
bootstrap,
2164+
message = "`main` has invalid return type `{Self}`",
2165+
label = "`main` can only return types that implement `{Termination}`"
2166+
)
21592167
)]
21602168
pub trait Termination {
21612169
/// Is called to get the representation of the value as status code.

0 commit comments

Comments
 (0)