From bd7213ff89122c8ef881ef402a97fce7aef17ec9 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 18 Dec 2024 02:59:07 +0900 Subject: [PATCH] tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore --- tests/assembly/asm/aarch64-el2vmsa.rs | 12 +++------ tests/assembly/asm/aarch64-modifiers.rs | 20 +++----------- tests/assembly/asm/aarch64-types.rs | 36 ++++--------------------- tests/assembly/asm/arm-modifiers.rs | 28 +++---------------- tests/assembly/asm/arm-types.rs | 33 +++-------------------- tests/assembly/asm/avr-modifiers.rs | 24 +++-------------- tests/assembly/asm/avr-types.rs | 24 +++-------------- tests/assembly/asm/bpf-types.rs | 28 +++---------------- tests/assembly/asm/hexagon-types.rs | 27 +++---------------- tests/assembly/asm/loongarch-type.rs | 29 +++----------------- tests/assembly/asm/m68k-types.rs | 24 +++-------------- tests/assembly/asm/mips-types.rs | 30 +++------------------ tests/assembly/asm/msp430-types.rs | 24 +++-------------- tests/assembly/asm/nvptx-types.rs | 28 ++++--------------- tests/assembly/asm/powerpc-types.rs | 34 ++++------------------- tests/assembly/asm/riscv-types.rs | 31 +++------------------ tests/assembly/asm/s390x-types.rs | 34 +++-------------------- tests/assembly/asm/sparc-types.rs | 31 +++------------------ tests/assembly/asm/wasm-types.rs | 28 ++++--------------- tests/assembly/asm/x86-modifiers.rs | 24 +++-------------- tests/assembly/asm/x86-types.rs | 26 +++--------------- tests/auxiliary/minicore.rs | 24 +++++++++++++++-- 22 files changed, 110 insertions(+), 489 deletions(-) diff --git a/tests/assembly/asm/aarch64-el2vmsa.rs b/tests/assembly/asm/aarch64-el2vmsa.rs index c217f008c070a..3652d58d85a07 100644 --- a/tests/assembly/asm/aarch64-el2vmsa.rs +++ b/tests/assembly/asm/aarch64-el2vmsa.rs @@ -1,18 +1,14 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: ttbr0_el2: #[no_mangle] diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index a4a41dd96c169..a3956d21a0677 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -1,29 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort //@ compile-flags: --target aarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; macro_rules! check { ($func:ident $reg:ident $code:literal) => { diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 22e60cd8159b0..439385b14b05b 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 arm64ec //@ assembly-output: emit-asm //@ [aarch64] compile-flags: --target aarch64-unknown-linux-gnu @@ -6,33 +7,15 @@ //@ [arm64ec] needs-llvm-components: aarch64 //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16, f128)] +#![feature(no_core, repr_simd, f16, f128)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] // FIXME(f16_f128): Only needed for FIXME in check! and check_reg! -#![feature(auto_traits)] +#![feature(auto_traits, lang_items)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -65,15 +48,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for f16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for f128 {} -impl Copy for ptr {} impl Copy for i8x8 {} impl Copy for i16x4 {} impl Copy for i32x2 {} diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 7d8d7e8387037..562b6bed74c35 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort //@ compile-flags: --target armv7-unknown-linux-gnueabihf @@ -5,38 +6,17 @@ //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: arm -#![feature(no_core, lang_items, rustc_attrs, repr_simd)] +#![feature(no_core, repr_simd)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f32x4([f32; 4]); -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for f64 {} impl Copy for f32x4 {} macro_rules! check { diff --git a/tests/assembly/asm/arm-types.rs b/tests/assembly/asm/arm-types.rs index 9cebb588aaf86..fb93f474c20eb 100644 --- a/tests/assembly/asm/arm-types.rs +++ b/tests/assembly/asm/arm-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: base d32 neon //@ assembly-output: emit-asm //@ compile-flags: --target armv7-unknown-linux-gnueabihf @@ -8,31 +9,13 @@ //@[neon] filecheck-flags: --check-prefix d32 //@ needs-llvm-components: arm -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16)] +#![feature(no_core, repr_simd, f16)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -61,14 +44,6 @@ pub struct f16x8([f16; 8]); #[repr(simd)] pub struct f32x4([f32; 4]); -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f16 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} impl Copy for i8x8 {} impl Copy for i16x4 {} impl Copy for i32x2 {} diff --git a/tests/assembly/asm/avr-modifiers.rs b/tests/assembly/asm/avr-modifiers.rs index e94375f959692..585fdd7b72534 100644 --- a/tests/assembly/asm/avr-modifiers.rs +++ b/tests/assembly/asm/avr-modifiers.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target avr-unknown-gnu-atmega328 //@ needs-llvm-components: avr -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $hi:literal $lo:literal $reg:tt) => { #[no_mangle] diff --git a/tests/assembly/asm/avr-types.rs b/tests/assembly/asm/avr-types.rs index 88b16895e8dc0..25cf3ec3b4bde 100644 --- a/tests/assembly/asm/avr-types.rs +++ b/tests/assembly/asm/avr-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target avr-unknown-gnu-atmega328 //@ needs-llvm-components: avr -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/bpf-types.rs b/tests/assembly/asm/bpf-types.rs index 0a9ec7dd52ba7..07ea7bd5ce055 100644 --- a/tests/assembly/asm/bpf-types.rs +++ b/tests/assembly/asm/bpf-types.rs @@ -1,38 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target bpfel-unknown-none -C target_feature=+alu32 //@ needs-llvm-components: bpf -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/hexagon-types.rs b/tests/assembly/asm/hexagon-types.rs index 9389fcf9cbac9..ce80fa75b359b 100644 --- a/tests/assembly/asm/hexagon-types.rs +++ b/tests/assembly/asm/hexagon-types.rs @@ -1,38 +1,19 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target hexagon-unknown-linux-musl //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: hexagon -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs index c51d35876d92d..86d9e03bc9315 100644 --- a/tests/assembly/asm/loongarch-type.rs +++ b/tests/assembly/asm/loongarch-type.rs @@ -1,40 +1,19 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target loongarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: loongarch -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly/asm/m68k-types.rs index b3e86b709c3dc..9e4f6d9a1a9d5 100644 --- a/tests/assembly/asm/m68k-types.rs +++ b/tests/assembly/asm/m68k-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target m68k-unknown-linux-gnu //@ needs-llvm-components: m68k -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident $mov:literal) => { #[no_mangle] diff --git a/tests/assembly/asm/mips-types.rs b/tests/assembly/asm/mips-types.rs index f40a28be4a7e1..00e8ce0b874aa 100644 --- a/tests/assembly/asm/mips-types.rs +++ b/tests/assembly/asm/mips-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: mips32 mips64 //@ assembly-output: emit-asm //@[mips32] compile-flags: --target mips-unknown-linux-gnu @@ -6,39 +7,16 @@ //@[mips64] needs-llvm-components: mips //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/msp430-types.rs b/tests/assembly/asm/msp430-types.rs index ae09b8b070da2..442dc77999f54 100644 --- a/tests/assembly/asm/msp430-types.rs +++ b/tests/assembly/asm/msp430-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target msp430-none-elf //@ needs-llvm-components: msp430 -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i16; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/nvptx-types.rs b/tests/assembly/asm/nvptx-types.rs index 0dd3162b4c02b..7e8ebd03024e4 100644 --- a/tests/assembly/asm/nvptx-types.rs +++ b/tests/assembly/asm/nvptx-types.rs @@ -1,35 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target nvptx64-nvidia-cuda -//@ compile-flags: --crate-type cdylib //@ needs-llvm-components: nvptx -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] +#![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - // NVPTX does not support static variables #[no_mangle] fn extern_func() {} diff --git a/tests/assembly/asm/powerpc-types.rs b/tests/assembly/asm/powerpc-types.rs index aa35c4d886581..4291e4c02f3be 100644 --- a/tests/assembly/asm/powerpc-types.rs +++ b/tests/assembly/asm/powerpc-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: powerpc powerpc_altivec powerpc_vsx powerpc64 powerpc64_vsx //@ assembly-output: emit-asm //@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu @@ -12,11 +13,14 @@ //@[powerpc64_vsx] needs-llvm-components: powerpc //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +extern crate minicore; +use minicore::*; + #[cfg_attr(altivec, cfg(not(target_feature = "altivec")))] #[cfg_attr(not(altivec), cfg(target_feature = "altivec"))] compile_error!("altivec cfg and target feature mismatch"); @@ -24,26 +28,6 @@ compile_error!("altivec cfg and target feature mismatch"); #[cfg_attr(not(vsx), cfg(target_feature = "vsx"))] compile_error!("vsx cfg and target feature mismatch"); -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [T; N] {} - type ptr = *const i32; #[repr(simd)] @@ -59,14 +43,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} impl Copy for i8x16 {} impl Copy for i16x8 {} impl Copy for i32x4 {} diff --git a/tests/assembly/asm/riscv-types.rs b/tests/assembly/asm/riscv-types.rs index 1f5d7d85b0ad9..724aa154da8c0 100644 --- a/tests/assembly/asm/riscv-types.rs +++ b/tests/assembly/asm/riscv-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: riscv64 riscv32 riscv64-zfhmin riscv32-zfhmin riscv64-zfh riscv32-zfh //@ assembly-output: emit-asm @@ -29,40 +30,16 @@ //@ compile-flags: -C target-feature=+d //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, f16)] +#![feature(no_core, f16)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for f16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/s390x-types.rs b/tests/assembly/asm/s390x-types.rs index 3da22d6c77b62..e6fe38ecb0df2 100644 --- a/tests/assembly/asm/s390x-types.rs +++ b/tests/assembly/asm/s390x-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: s390x s390x_vector //@ assembly-output: emit-asm //@[s390x] compile-flags: --target s390x-unknown-linux-gnu @@ -6,31 +7,14 @@ //@[s390x_vector] needs-llvm-components: systemz //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f128)] +#![feature(no_core, repr_simd, f128)] #![cfg_attr(s390x_vector, feature(asm_experimental_reg))] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *const i32; @@ -47,16 +31,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for i128 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for f128 {} -impl Copy for ptr {} impl Copy for i8x16 {} impl Copy for i16x8 {} impl Copy for i32x4 {} diff --git a/tests/assembly/asm/sparc-types.rs b/tests/assembly/asm/sparc-types.rs index 2270679e837e3..49cc377cd9527 100644 --- a/tests/assembly/asm/sparc-types.rs +++ b/tests/assembly/asm/sparc-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc64 //@ assembly-output: emit-asm //@[sparc] compile-flags: --target sparc-unknown-none-elf @@ -8,40 +9,16 @@ //@[sparc64] needs-llvm-components: sparc //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/wasm-types.rs b/tests/assembly/asm/wasm-types.rs index fe5ce836bc6e5..78e555c53173a 100644 --- a/tests/assembly/asm/wasm-types.rs +++ b/tests/assembly/asm/wasm-types.rs @@ -1,35 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target wasm32-unknown-unknown -//@ compile-flags: --crate-type cdylib //@ needs-llvm-components: webassembly -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] +#![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 5a48af9205f75..53e4b92f84acb 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort @@ -9,30 +10,13 @@ //@ compile-flags: -C target-feature=+avx512bw //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; macro_rules! check { ($func:ident $modifier:literal $reg:ident $mov:literal) => { diff --git a/tests/assembly/asm/x86-types.rs b/tests/assembly/asm/x86-types.rs index 567dc7a8245fe..6120ed0d53275 100644 --- a/tests/assembly/asm/x86-types.rs +++ b/tests/assembly/asm/x86-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu @@ -8,31 +9,13 @@ //@ compile-flags: -C target-feature=+avx512bw //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16, f128)] +#![feature(no_core, repr_simd, f16, f128)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -90,7 +73,6 @@ macro_rules! impl_copy { } impl_copy!( - i8 i16 f16 i32 f32 i64 f64 f128 ptr i8x16 i16x8 i32x4 i64x2 f16x8 f32x4 f64x2 i8x32 i16x16 i32x8 i64x4 f16x16 f32x8 f64x4 i8x64 i16x32 i32x16 i64x8 f16x32 f32x16 f64x8 diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 2fa0c550efbc8..a68552175c318 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -14,7 +14,7 @@ //! . // ignore-tidy-linelength -#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions)] +#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions, f16, f128)] #![allow(unused, improper_ctypes_definitions, internal_features)] #![feature(asm_experimental_arch)] #![no_std] @@ -40,7 +40,12 @@ impl LegacyReceiver for &mut T {} pub trait Copy: Sized {} impl_marker_trait!( - Copy => [ bool, char, isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64 ] + Copy => [ + bool, char, + isize, i8, i16, i32, i64, i128, + usize, u8, u16, u32, u64, u128, + f16, f32, f64, f128, + ] ); impl<'a, T: ?Sized> Copy for &'a T {} impl Copy for *const T {} @@ -88,3 +93,18 @@ pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) { /* compiler built-in */ } + +#[rustc_builtin_macro] +#[macro_export] +macro_rules! concat { + ($($e:expr),* $(,)?) => { + /* compiler built-in */ + }; +} +#[rustc_builtin_macro] +#[macro_export] +macro_rules! stringify { + ($($t:tt)*) => { + /* compiler built-in */ + }; +}