Skip to content

Commit e94827e

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 21b2465 + 6e7d206 commit e94827e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+161
-135
lines changed

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
192192
}
193193
}
194194
InlineAsmOperand::Sym { ref sym } => {
195-
if !self.tcx.features().asm_sym {
196-
feature_err(
197-
&sess.parse_sess,
198-
sym::asm_sym,
199-
*op_sp,
200-
"sym operands for inline assembly are unstable",
201-
)
202-
.emit();
203-
}
204-
205195
let static_def_id = self
206196
.resolver
207197
.get_partial_res(sym.id)

compiler/rustc_codegen_gcc/tests/run/asm.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// Run-time:
44
// status: 0
55

6-
#![feature(asm_const, asm_sym)]
6+
#![feature(asm_const)]
77

88
use std::arch::{asm, global_asm};
99

10-
global_asm!("
10+
global_asm!(
11+
"
1112
.global add_asm
1213
add_asm:
1314
mov rax, rdi
@@ -132,7 +133,9 @@ fn main() {
132133
assert_eq!(x, 43);
133134

134135
// check sym fn
135-
extern "C" fn foo() -> u64 { 42 }
136+
extern "C" fn foo() -> u64 {
137+
42
138+
}
136139
let x: u64;
137140
unsafe {
138141
asm!("call {}", sym foo, lateout("rax") x);

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ declare_features! (
5353
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
5454
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
5555
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
56+
/// Allows using `sym` operands in inline assembly.
57+
(accepted, asm_sym, "CURRENT_RUSTC_VERSION", Some(93333), None),
5658
/// Allows the definition of associated constants in `trait` or `impl` blocks.
5759
(accepted, associated_consts, "1.20.0", Some(29646), None),
5860
/// Allows using associated `type`s in `trait`s.

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ declare_features! (
300300
(active, asm_const, "1.58.0", Some(93332), None),
301301
/// Enables experimental inline assembly support for additional architectures.
302302
(active, asm_experimental_arch, "1.58.0", Some(93335), None),
303-
/// Allows using `sym` operands in inline assembly.
304-
(active, asm_sym, "1.58.0", Some(93333), None),
305303
/// Allows the `may_unwind` option in inline assembly.
306304
(active, asm_unwind, "1.58.0", Some(93334), None),
307305
/// Allows users to enforce equality of associated constants `TraitImpl<AssocConst=3>`.

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ symbols! {
451451
call_once,
452452
caller_location,
453453
capture_disjoint_fields,
454+
cause,
454455
cdylib,
455456
ceilf32,
456457
ceilf64,

compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
164164
flags.push((sym::from_desugaring, Some(format!("{:?}", k))));
165165
}
166166

167+
if let ObligationCauseCode::MainFunctionType = obligation.cause.code() {
168+
flags.push((sym::cause, Some("MainFunctionType".to_string())));
169+
}
170+
167171
// Add all types without trimmed paths.
168172
ty::print::with_no_trimmed_paths!({
169173
let generics = self.tcx.generics_of(def_id);

library/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)]

library/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

library/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();

library/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

0 commit comments

Comments
 (0)