mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
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
This commit is contained in:
commit
e94827e5b0
@ -192,16 +192,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
}
|
||||
}
|
||||
InlineAsmOperand::Sym { ref sym } => {
|
||||
if !self.tcx.features().asm_sym {
|
||||
feature_err(
|
||||
&sess.parse_sess,
|
||||
sym::asm_sym,
|
||||
*op_sp,
|
||||
"sym operands for inline assembly are unstable",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
let static_def_id = self
|
||||
.resolver
|
||||
.get_partial_res(sym.id)
|
||||
|
@ -3,11 +3,12 @@
|
||||
// Run-time:
|
||||
// status: 0
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
global_asm!("
|
||||
global_asm!(
|
||||
"
|
||||
.global add_asm
|
||||
add_asm:
|
||||
mov rax, rdi
|
||||
@ -132,7 +133,9 @@ fn main() {
|
||||
assert_eq!(x, 43);
|
||||
|
||||
// check sym fn
|
||||
extern "C" fn foo() -> u64 { 42 }
|
||||
extern "C" fn foo() -> u64 {
|
||||
42
|
||||
}
|
||||
let x: u64;
|
||||
unsafe {
|
||||
asm!("call {}", sym foo, lateout("rax") x);
|
||||
|
@ -53,6 +53,8 @@ declare_features! (
|
||||
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
|
||||
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
|
||||
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
|
||||
/// Allows using `sym` operands in inline assembly.
|
||||
(accepted, asm_sym, "CURRENT_RUSTC_VERSION", Some(93333), None),
|
||||
/// Allows the definition of associated constants in `trait` or `impl` blocks.
|
||||
(accepted, associated_consts, "1.20.0", Some(29646), None),
|
||||
/// Allows using associated `type`s in `trait`s.
|
||||
|
@ -300,8 +300,6 @@ declare_features! (
|
||||
(active, asm_const, "1.58.0", Some(93332), None),
|
||||
/// Enables experimental inline assembly support for additional architectures.
|
||||
(active, asm_experimental_arch, "1.58.0", Some(93335), None),
|
||||
/// Allows using `sym` operands in inline assembly.
|
||||
(active, asm_sym, "1.58.0", Some(93333), None),
|
||||
/// Allows the `may_unwind` option in inline assembly.
|
||||
(active, asm_unwind, "1.58.0", Some(93334), None),
|
||||
/// Allows users to enforce equality of associated constants `TraitImpl<AssocConst=3>`.
|
||||
|
@ -451,6 +451,7 @@ symbols! {
|
||||
call_once,
|
||||
caller_location,
|
||||
capture_disjoint_fields,
|
||||
cause,
|
||||
cdylib,
|
||||
ceilf32,
|
||||
ceilf64,
|
||||
|
@ -164,6 +164,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
flags.push((sym::from_desugaring, Some(format!("{:?}", k))));
|
||||
}
|
||||
|
||||
if let ObligationCauseCode::MainFunctionType = obligation.cause.code() {
|
||||
flags.push((sym::cause, Some("MainFunctionType".to_string())));
|
||||
}
|
||||
|
||||
// Add all types without trimmed paths.
|
||||
ty::print::with_no_trimmed_paths!({
|
||||
let generics = self.tcx.generics_of(def_id);
|
||||
|
@ -125,9 +125,9 @@
|
||||
#![feature(iter_advance_by)]
|
||||
#![feature(iter_next_chunk)]
|
||||
#![feature(layout_for_ptr)]
|
||||
#![feature(maybe_uninit_array_assume_init)]
|
||||
#![feature(maybe_uninit_slice)]
|
||||
#![feature(maybe_uninit_uninit_array)]
|
||||
#![feature(maybe_uninit_uninit_array_transpose)]
|
||||
#![cfg_attr(test, feature(new_uninit))]
|
||||
#![feature(nonnull_slice_from_raw_parts)]
|
||||
#![feature(pattern)]
|
||||
|
@ -223,7 +223,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
|
||||
|
||||
self.ptr = self.ptr.wrapping_byte_add(N);
|
||||
// Safety: ditto
|
||||
return Ok(unsafe { MaybeUninit::array_assume_init(raw_ary) });
|
||||
return Ok(unsafe { raw_ary.transpose().assume_init() });
|
||||
}
|
||||
|
||||
if len < N {
|
||||
@ -241,7 +241,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
|
||||
return unsafe {
|
||||
ptr::copy_nonoverlapping(self.ptr, raw_ary.as_mut_ptr() as *mut T, N);
|
||||
self.ptr = self.ptr.add(N);
|
||||
Ok(MaybeUninit::array_assume_init(raw_ary))
|
||||
Ok(raw_ary.transpose().assume_init())
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,7 @@ impl<T, const N: usize> IntoIter<T, N> {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(array_into_iter_constructors)]
|
||||
///
|
||||
/// #![feature(maybe_uninit_array_assume_init)]
|
||||
/// #![feature(maybe_uninit_uninit_array_transpose)]
|
||||
/// #![feature(maybe_uninit_uninit_array)]
|
||||
/// use std::array::IntoIter;
|
||||
/// use std::mem::MaybeUninit;
|
||||
@ -134,7 +133,7 @@ impl<T, const N: usize> IntoIter<T, N> {
|
||||
/// }
|
||||
///
|
||||
/// // SAFETY: We've initialized all N items
|
||||
/// unsafe { Ok(MaybeUninit::array_assume_init(buffer)) }
|
||||
/// unsafe { Ok(buffer.transpose().assume_init()) }
|
||||
/// }
|
||||
///
|
||||
/// let r: [_; 4] = next_chunk(&mut (10..16)).unwrap();
|
||||
|
@ -912,7 +912,7 @@ where
|
||||
|
||||
mem::forget(guard);
|
||||
// SAFETY: All elements of the array were populated in the loop above.
|
||||
let output = unsafe { MaybeUninit::array_assume_init(array) };
|
||||
let output = unsafe { array.transpose().assume_init() };
|
||||
Ok(Try::from_output(output))
|
||||
}
|
||||
|
||||
|
@ -869,7 +869,7 @@ macro_rules! int_impl {
|
||||
// Deal with the final bit of the exponent separately, since
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
Some(try_opt!(acc.checked_mul(base)))
|
||||
acc.checked_mul(base)
|
||||
}
|
||||
|
||||
/// Saturating integer addition. Computes `self + rhs`, saturating at the numeric
|
||||
|
@ -990,7 +990,7 @@ macro_rules! uint_impl {
|
||||
// squaring the base afterwards is not necessary and may cause a
|
||||
// needless overflow.
|
||||
|
||||
Some(try_opt!(acc.checked_mul(base)))
|
||||
acc.checked_mul(base)
|
||||
}
|
||||
|
||||
/// Saturating integer addition. Computes `self + rhs`, saturating at
|
||||
|
@ -267,7 +267,7 @@ pub unsafe trait Searcher<'a> {
|
||||
/// The index ranges returned by this trait are not required
|
||||
/// to exactly match those of the forward search in reverse.
|
||||
///
|
||||
/// For the reason why this trait is marked unsafe, see them
|
||||
/// For the reason why this trait is marked unsafe, see the
|
||||
/// parent trait [`Searcher`].
|
||||
pub unsafe trait ReverseSearcher<'a>: Searcher<'a> {
|
||||
/// Performs the next search step starting from the back.
|
||||
|
@ -49,8 +49,8 @@
|
||||
#![feature(slice_from_ptr_range)]
|
||||
#![feature(split_as_slice)]
|
||||
#![feature(maybe_uninit_uninit_array)]
|
||||
#![feature(maybe_uninit_array_assume_init)]
|
||||
#![feature(maybe_uninit_write_slice)]
|
||||
#![feature(maybe_uninit_uninit_array_transpose)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(numfmt)]
|
||||
#![feature(step_trait)]
|
||||
|
@ -163,18 +163,18 @@ fn assume_init_good() {
|
||||
|
||||
#[test]
|
||||
fn uninit_array_assume_init() {
|
||||
let mut array: [MaybeUninit<i16>; 5] = MaybeUninit::uninit_array();
|
||||
let mut array = [MaybeUninit::<i16>::uninit(); 5];
|
||||
array[0].write(3);
|
||||
array[1].write(1);
|
||||
array[2].write(4);
|
||||
array[3].write(1);
|
||||
array[4].write(5);
|
||||
|
||||
let array = unsafe { MaybeUninit::array_assume_init(array) };
|
||||
let array = unsafe { array.transpose().assume_init() };
|
||||
|
||||
assert_eq!(array, [3, 1, 4, 1, 5]);
|
||||
|
||||
let [] = unsafe { MaybeUninit::<!>::array_assume_init([]) };
|
||||
let [] = unsafe { [MaybeUninit::<!>::uninit(); 0].transpose().assume_init() };
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2154,8 +2154,16 @@ pub fn id() -> u32 {
|
||||
#[cfg_attr(not(test), lang = "termination")]
|
||||
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
|
||||
#[rustc_on_unimplemented(
|
||||
message = "`main` has invalid return type `{Self}`",
|
||||
label = "`main` can only return types that implement `{Termination}`"
|
||||
on(
|
||||
all(not(bootstrap), cause = "MainFunctionType"),
|
||||
message = "`main` has invalid return type `{Self}`",
|
||||
label = "`main` can only return types that implement `{Termination}`"
|
||||
),
|
||||
on(
|
||||
bootstrap,
|
||||
message = "`main` has invalid return type `{Self}`",
|
||||
label = "`main` can only return types that implement `{Termination}`"
|
||||
)
|
||||
)]
|
||||
pub trait Termination {
|
||||
/// Is called to get the representation of the value as status code.
|
||||
|
@ -1,13 +0,0 @@
|
||||
# `asm_sym`
|
||||
|
||||
The tracking issue for this feature is: [#93333]
|
||||
|
||||
[#93333]: https://github.com/rust-lang/rust/issues/93333
|
||||
|
||||
------------------------
|
||||
|
||||
This feature adds a `sym <path>` operand type to `asm!` and `global_asm!`.
|
||||
- `<path>` must refer to a `fn` or `static`.
|
||||
- A mangled symbol name referring to the item is substituted into the asm template string.
|
||||
- The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
|
||||
- `<path>` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: --target aarch64-unknown-linux-gnu
|
||||
// needs-llvm-components: aarch64
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
// compile-flags: -C target-feature=+neon
|
||||
// needs-llvm-components: arm
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: --target avr-unknown-gnu-atmega328
|
||||
// needs-llvm-components: avr
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: --target bpfel-unknown-none -C target_feature=+alu32
|
||||
// needs-llvm-components: bpf
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -4,7 +4,7 @@
|
||||
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
|
||||
// compile-flags: -C symbol-mangling-version=v0
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
use std::arch::global_asm;
|
||||
@ -28,4 +28,6 @@ global_asm!("lea rax, [rip + {}]", sym MY_STATIC);
|
||||
// CHECK: call _RNvCsiubXh4Yz005_10global_asm6foobar
|
||||
global_asm!("call {}", sym foobar);
|
||||
// CHECK: _RNvCsiubXh4Yz005_10global_asm6foobar:
|
||||
fn foobar() { loop {} }
|
||||
fn foobar() {
|
||||
loop {}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: --target hexagon-unknown-linux-musl
|
||||
// needs-llvm-components: hexagon
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -5,7 +5,7 @@
|
||||
//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
|
||||
//[mips64] needs-llvm-components: mips
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
// compile-flags: --target msp430-none-elf
|
||||
// needs-llvm-components: msp430
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch, asm_const)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch, asm_const)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
// compile-flags: --crate-type cdylib
|
||||
// needs-llvm-components: nvptx
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
|
||||
#![no_core]
|
||||
|
||||
#[rustc_builtin_macro]
|
||||
|
@ -5,7 +5,7 @@
|
||||
//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
|
||||
//[powerpc64] needs-llvm-components: powerpc
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -6,7 +6,7 @@
|
||||
//[riscv32] needs-llvm-components: riscv
|
||||
// compile-flags: -C target-feature=+d
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_sym)]
|
||||
#![feature(no_core, lang_items, rustc_attrs)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
//[s390x] compile-flags: --target s390x-unknown-linux-gnu
|
||||
//[s390x] needs-llvm-components: systemz
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
// compile-flags: --crate-type cdylib
|
||||
// needs-llvm-components: webassembly
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_sym, asm_experimental_arch)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)]
|
||||
#![no_core]
|
||||
|
||||
#[rustc_builtin_macro]
|
||||
|
@ -7,7 +7,7 @@
|
||||
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
|
||||
// compile-flags: -C target-feature=+avx512bw
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_sym)]
|
||||
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
#![allow(asm_sub_register, non_camel_case_types)]
|
||||
|
@ -6,20 +6,30 @@
|
||||
// ignore-arm
|
||||
// ignore-aarch64
|
||||
// needs-asm-support
|
||||
#![feature(asm_sym)]
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64,
|
||||
rcx: i64, r8 : i64, r9 : i64,
|
||||
xmm0: f32, xmm1: f32, xmm2: f32,
|
||||
xmm3: f32, xmm4: f32, xmm5: f32,
|
||||
xmm6: f32, xmm7: f32) -> i64 {
|
||||
pub extern "sysv64" fn all_the_registers(
|
||||
rdi: i64,
|
||||
rsi: i64,
|
||||
rdx: i64,
|
||||
rcx: i64,
|
||||
r8: i64,
|
||||
r9: i64,
|
||||
xmm0: f32,
|
||||
xmm1: f32,
|
||||
xmm2: f32,
|
||||
xmm3: f32,
|
||||
xmm4: f32,
|
||||
xmm5: f32,
|
||||
xmm6: f32,
|
||||
xmm7: f32,
|
||||
) -> i64 {
|
||||
assert_eq!(rdi, 1);
|
||||
assert_eq!(rsi, 2);
|
||||
assert_eq!(rdx, 3);
|
||||
assert_eq!(rcx, 4);
|
||||
assert_eq!(r8, 5);
|
||||
assert_eq!(r9, 6);
|
||||
assert_eq!(r8, 5);
|
||||
assert_eq!(r9, 6);
|
||||
assert_eq!(xmm0, 1.0f32);
|
||||
assert_eq!(xmm1, 2.0f32);
|
||||
assert_eq!(xmm2, 4.0f32);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// only-aarch64
|
||||
// compile-flags: -C target-feature=+neon
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// run-pass
|
||||
// needs-asm-support
|
||||
|
||||
#![feature(asm_sym, asm_unwind)]
|
||||
#![feature(asm_unwind)]
|
||||
|
||||
use std::arch::asm;
|
||||
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
|
||||
|
@ -3,7 +3,7 @@
|
||||
// needs-asm-support
|
||||
// run-pass
|
||||
|
||||
#![feature(thread_local, asm_sym)]
|
||||
#![feature(thread_local)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// only-aarch64
|
||||
|
||||
#![feature(repr_simd, never_type, asm_sym)]
|
||||
#![feature(repr_simd, never_type)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// only-aarch64
|
||||
|
||||
#![feature(repr_simd, never_type, asm_sym)]
|
||||
#![feature(repr_simd, never_type)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// needs-asm-support
|
||||
// build-pass
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
// ignore-wasm32
|
||||
|
||||
#![feature(naked_functions)]
|
||||
#![feature(asm_const, asm_sym, asm_unwind)]
|
||||
#![feature(asm_const, asm_unwind)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use std::arch::asm;
|
||||
|
@ -3,7 +3,7 @@
|
||||
// ignore-spirv
|
||||
// ignore-wasm32
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// only-x86_64
|
||||
// compile-flags: -C target-feature=+avx2
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
// regression test for #96797
|
||||
|
||||
#![feature(asm_sym)]
|
||||
|
||||
use std::arch::global_asm;
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -3,7 +3,7 @@
|
||||
// needs-asm-support
|
||||
// needs-unwind
|
||||
|
||||
#![feature(asm_sym, asm_unwind)]
|
||||
#![feature(asm_unwind)]
|
||||
|
||||
use std::arch::asm;
|
||||
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
// Checks that multiple clobber_abi options can be used
|
||||
|
||||
#![feature(asm_sym)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
extern "sysv64" fn foo(x: i32) -> i32 {
|
||||
|
@ -3,7 +3,7 @@
|
||||
// needs-asm-support
|
||||
// run-pass
|
||||
|
||||
#![feature(thread_local, asm_sym)]
|
||||
#![feature(thread_local)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// only-x86_64
|
||||
|
||||
#![feature(repr_simd, never_type, asm_sym)]
|
||||
#![feature(repr_simd, never_type)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
// only-x86_64
|
||||
// compile-flags: -C target-feature=+avx512f
|
||||
|
||||
#![feature(asm_const, asm_sym)]
|
||||
#![feature(asm_const)]
|
||||
|
||||
use std::arch::{asm, global_asm};
|
||||
|
||||
use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps};
|
||||
|
||||
fn main() {
|
||||
}
|
||||
fn main() {}
|
||||
|
||||
// Constants must be... constant
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0013]: constants cannot refer to statics
|
||||
--> $DIR/type-check-4.rs:22:25
|
||||
--> $DIR/type-check-4.rs:21:25
|
||||
|
|
||||
LL | global_asm!("{}", const S);
|
||||
| ^
|
||||
@ -7,7 +7,7 @@ LL | global_asm!("{}", const S);
|
||||
= help: consider extracting the value of the `static` to a `const`, and referring to that
|
||||
|
||||
error[E0013]: constants cannot refer to statics
|
||||
--> $DIR/type-check-4.rs:25:35
|
||||
--> $DIR/type-check-4.rs:24:35
|
||||
|
|
||||
LL | global_asm!("{}", const const_foo(S));
|
||||
| ^
|
||||
@ -15,7 +15,7 @@ LL | global_asm!("{}", const const_foo(S));
|
||||
= help: consider extracting the value of the `static` to a `const`, and referring to that
|
||||
|
||||
error[E0013]: constants cannot refer to statics
|
||||
--> $DIR/type-check-4.rs:28:35
|
||||
--> $DIR/type-check-4.rs:27:35
|
||||
|
|
||||
LL | global_asm!("{}", const const_bar(S));
|
||||
| ^
|
||||
|
@ -1,6 +1,6 @@
|
||||
// only-x86_64
|
||||
|
||||
#![feature(repr_simd, never_type, asm_sym)]
|
||||
#![feature(repr_simd, never_type)]
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// ignore-emscripten no processes
|
||||
// ignore-sgx no processes
|
||||
// ignore-fuchsia Needs directory creation privilege
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
|
@ -1,19 +0,0 @@
|
||||
// only-x86_64
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
fn bar<const N: usize>() {}
|
||||
|
||||
fn foo<const N: usize>() {
|
||||
unsafe {
|
||||
asm!("mov eax, {}", sym bar::<N>);
|
||||
//~^ ERROR sym operands for inline assembly are unstable
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
asm!("mov eax, {}", sym foo::<0>);
|
||||
//~^ ERROR sym operands for inline assembly are unstable
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
error[E0658]: sym operands for inline assembly are unstable
|
||||
--> $DIR/feature-gate-asm_sym.rs:9:29
|
||||
|
|
||||
LL | asm!("mov eax, {}", sym bar::<N>);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
|
||||
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: sym operands for inline assembly are unstable
|
||||
--> $DIR/feature-gate-asm_sym.rs:16:29
|
||||
|
|
||||
LL | asm!("mov eax, {}", sym foo::<0>);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
|
||||
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// ignore-emscripten no processes
|
||||
// ignore-sgx no processes
|
||||
// ignore-fuchsia Child I/O swaps not privileged
|
||||
|
||||
// Previously libstd would set stdio descriptors of a child process
|
||||
// by `dup`ing the requested descriptors to inherit directly into the
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
// ignore-emscripten no processes
|
||||
// ignore-sgx no processes
|
||||
// ignore-fuchsia Filesystem manipulation privileged
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::io;
|
||||
|
11
src/test/ui/rfc-1937-termination-trait/issue-103052-1.rs
Normal file
11
src/test/ui/rfc-1937-termination-trait/issue-103052-1.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Check that we don't blindly emit a diagnostic claiming that "`main` has an invalid return type"
|
||||
// if we encounter a type that doesn't implement `std::process::Termination` and is not actually
|
||||
// the return type of the program entry `main`.
|
||||
|
||||
fn receive(_: impl std::process::Termination) {}
|
||||
|
||||
struct Something;
|
||||
|
||||
fn main() {
|
||||
receive(Something); //~ ERROR the trait bound `Something: Termination` is not satisfied
|
||||
}
|
17
src/test/ui/rfc-1937-termination-trait/issue-103052-1.stderr
Normal file
17
src/test/ui/rfc-1937-termination-trait/issue-103052-1.stderr
Normal file
@ -0,0 +1,17 @@
|
||||
error[E0277]: the trait bound `Something: Termination` is not satisfied
|
||||
--> $DIR/issue-103052-1.rs:10:13
|
||||
|
|
||||
LL | receive(Something);
|
||||
| ------- ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `receive`
|
||||
--> $DIR/issue-103052-1.rs:5:20
|
||||
|
|
||||
LL | fn receive(_: impl std::process::Termination) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `receive`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
18
src/test/ui/rfc-1937-termination-trait/issue-103052-2.rs
Normal file
18
src/test/ui/rfc-1937-termination-trait/issue-103052-2.rs
Normal file
@ -0,0 +1,18 @@
|
||||
#![feature(return_position_impl_trait_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
mod child {
|
||||
trait Main {
|
||||
fn main() -> impl std::process::Termination;
|
||||
}
|
||||
|
||||
struct Something;
|
||||
|
||||
impl Main for () {
|
||||
fn main() -> Something { //~ ERROR the trait bound `Something: Termination` is not satisfied
|
||||
Something
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
15
src/test/ui/rfc-1937-termination-trait/issue-103052-2.stderr
Normal file
15
src/test/ui/rfc-1937-termination-trait/issue-103052-2.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
error[E0277]: the trait bound `Something: Termination` is not satisfied
|
||||
--> $DIR/issue-103052-2.rs:12:22
|
||||
|
|
||||
LL | fn main() -> Something {
|
||||
| ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
|
||||
|
|
||||
note: required by a bound in `Main::main::{opaque#0}`
|
||||
--> $DIR/issue-103052-2.rs:6:27
|
||||
|
|
||||
LL | fn main() -> impl std::process::Termination;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::main::{opaque#0}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -1,4 +1,4 @@
|
||||
error[E0277]: `main` has invalid return type `f32`
|
||||
error[E0277]: the trait bound `f32: Termination` is not satisfied
|
||||
--> $DIR/termination-trait-test-wrong-type.rs:6:1
|
||||
|
|
||||
LL | #[test]
|
||||
@ -6,9 +6,8 @@ LL | #[test]
|
||||
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
|
||||
LL | | "0".parse()
|
||||
LL | | }
|
||||
| |_^ `main` can only return types that implement `Termination`
|
||||
| |_^ the trait `Termination` is not implemented for `f32`
|
||||
|
|
||||
= help: the trait `Termination` is not implemented for `f32`
|
||||
= note: required for `Result<f32, ParseFloatError>` to implement `Termination`
|
||||
note: required by a bound in `assert_test_result`
|
||||
--> $SRC_DIR/test/src/lib.rs:LL:COL
|
||||
|
@ -1,4 +1,5 @@
|
||||
// run-pass
|
||||
// ignore-fuchsia Test must be run out-of-process
|
||||
|
||||
#![feature(test)]
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
// ignore-emscripten no threads support
|
||||
// needs-unwind
|
||||
|
||||
#[test]
|
||||
fn thready_pass() {
|
||||
|
@ -10,7 +10,7 @@ fee
|
||||
fie
|
||||
foe
|
||||
fum
|
||||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-capture.rs:31:5
|
||||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-capture.rs:32:5
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
// ignore-emscripten no threads support
|
||||
// needs-unwind
|
||||
|
||||
#[test]
|
||||
fn thready_pass() {
|
||||
|
@ -1,2 +1,2 @@
|
||||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:31:5
|
||||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:32:5
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// ignore-wasm32-bare networking not available
|
||||
// ignore-sgx ToSocketAddrs cannot be used for DNS Resolution
|
||||
// ignore-fuchsia Req. test-harness networking privileges
|
||||
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user