Skip to content

Commit 50ed7f9

Browse files
authored
Rollup merge of rust-lang#137599 - davidtwco:use-minicore-more, r=jieyouxu
tests: use minicore more minicore makes it much easier to add new language items to all of the existing `no_core` tests. Most of the remaining tests that *could* use minicore either fail because.. 1. LLVM IR output changes and doesn't pass the test as written. I didn't look into these further. 2. The test has revisions w/ different compilation flags, expecting some to fail, and when using minicore, minicore is compiled with those flags and fails in the expected way because of the flags rather than the test, and that's considered a failure. But these tests can be changed and make adding new language items a lot easier. r? ```@jieyouxu```
2 parents 50ef985 + 92eb445 commit 50ed7f9

File tree

183 files changed

+828
-1063
lines changed

Some content is hidden

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

183 files changed

+828
-1063
lines changed

Diff for: tests/assembly/aarch64-pointer-auth.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Test that PAC instructions are emitted when branch-protection is specified.
22

3+
//@ add-core-stubs
34
//@ revisions: PACRET PAUTHLR_NOP PAUTHLR
45
//@ assembly-output: emit-asm
56
//@ needs-llvm-components: aarch64
@@ -14,8 +15,8 @@
1415
#![no_core]
1516
#![crate_type = "lib"]
1617

17-
#[lang = "sized"]
18-
trait Sized {}
18+
extern crate minicore;
19+
use minicore::*;
1920

2021
// PACRET: hint #25
2122
// PACRET: hint #29

Diff for: tests/assembly/cmse.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: hard soft
23
//@ assembly-output: emit-asm
34
//@ [hard] compile-flags: --target thumbv8m.main-none-eabihf --crate-type lib -Copt-level=1
@@ -7,10 +8,9 @@
78
#![crate_type = "lib"]
89
#![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)]
910
#![no_core]
10-
#[lang = "sized"]
11-
pub trait Sized {}
12-
#[lang = "copy"]
13-
pub trait Copy {}
11+
12+
extern crate minicore;
13+
use minicore::*;
1414

1515
// CHECK-LABEL: __acle_se_entry_point:
1616
// CHECK-NEXT: entry_point:

Diff for: tests/assembly/dwarf4.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
// Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4.
22
//@ assembly-output: emit-asm
3+
//@ add-core-stubs
34
//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0
45
//@ needs-llvm-components: x86
56

67
#![feature(no_core, lang_items)]
78
#![crate_type = "rlib"]
89
#![no_core]
910

10-
#[lang = "sized"]
11-
trait Sized {}
12-
#[lang = "copy"]
13-
trait Copy {}
11+
extern crate minicore;
12+
use minicore::*;
1413

1514
pub fn wibble() {}
1615

Diff for: tests/assembly/dwarf5.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5.
2+
//@ add-core-stubs
23
//@ assembly-output: emit-asm
34
//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0
45
//@ needs-llvm-components: x86
@@ -7,10 +8,8 @@
78
#![crate_type = "rlib"]
89
#![no_core]
910

10-
#[lang = "sized"]
11-
trait Sized {}
12-
#[lang = "copy"]
13-
trait Copy {}
11+
extern crate minicore;
12+
use minicore::*;
1413

1514
pub fn wibble() {}
1615

Diff for: tests/assembly/pic-relocation-model.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x64
23
//@ assembly-output: emit-asm
34
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic
@@ -7,10 +8,8 @@
78
#![no_core]
89
#![crate_type = "rlib"]
910

10-
#[lang = "sized"]
11-
trait Sized {}
12-
#[lang = "copy"]
13-
trait Copy {}
11+
extern crate minicore;
12+
use minicore::*;
1413

1514
// CHECK-LABEL: call_other_fn:
1615
// CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip)

Diff for: tests/assembly/pie-relocation-model.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x64
23
//@ assembly-output: emit-asm
34
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie
@@ -7,10 +8,8 @@
78
#![no_core]
89
#![crate_type = "rlib"]
910

10-
#[lang = "sized"]
11-
trait Sized {}
12-
#[lang = "copy"]
13-
trait Copy {}
11+
extern crate minicore;
12+
use minicore::*;
1413

1514
// CHECK-LABEL: call_other_fn:
1615
// With PIE local functions are called "directly".

Diff for: tests/assembly/powerpc64-struct-abi.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: elfv1-be elfv2-be elfv2-le aix
23
//@ assembly-output: emit-asm
34
//@ compile-flags: -Copt-level=3
@@ -20,21 +21,9 @@
2021
#![no_core]
2122
#![crate_type = "lib"]
2223

23-
#[lang = "sized"]
24-
trait Sized {}
24+
extern crate minicore;
25+
use minicore::*;
2526

26-
#[lang = "copy"]
27-
trait Copy {}
28-
29-
#[lang = "freeze"]
30-
trait Freeze {}
31-
32-
#[lang = "unpin"]
33-
trait Unpin {}
34-
35-
impl Copy for u8 {}
36-
impl Copy for u16 {}
37-
impl Copy for u32 {}
3827
impl Copy for FiveU32s {}
3928
impl Copy for FiveU16s {}
4029
impl Copy for ThreeU8s {}

Diff for: tests/assembly/riscv-soft-abi-with-float-features.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ assembly-output: emit-asm
23
//@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d
34
//@ needs-llvm-components: riscv
@@ -9,15 +10,8 @@
910
#![crate_type = "lib"]
1011
#![no_core]
1112

12-
#[lang = "sized"]
13-
trait Sized {}
14-
15-
#[lang = "copy"]
16-
trait Copy {}
17-
18-
impl Copy for f16 {}
19-
impl Copy for f32 {}
20-
impl Copy for f64 {}
13+
extern crate minicore;
14+
use minicore::*;
2115

2216
// This test checks that the floats are all returned in `a0` as required by the `lp64` ABI.
2317

Diff for: tests/assembly/s390x-backchain-toggle.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: enable-backchain disable-backchain
23
//@ assembly-output: emit-asm
34
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu
@@ -8,8 +9,8 @@
89
#![no_std]
910
#![no_core]
1011

11-
#[lang = "sized"]
12-
trait Sized {}
12+
extern crate minicore;
13+
use minicore::*;
1314

1415
extern "C" {
1516
fn extern_func();

Diff for: tests/assembly/simd-bitmask.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86 x86-avx2 x86-avx512 aarch64
23
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86] needs-llvm-components: x86
@@ -16,12 +17,8 @@
1617
#![no_core]
1718
#![allow(non_camel_case_types)]
1819

19-
// Because we don't have core yet.
20-
#[lang = "sized"]
21-
pub trait Sized {}
22-
23-
#[lang = "copy"]
24-
trait Copy {}
20+
extern crate minicore;
21+
use minicore::*;
2522

2623
#[repr(simd)]
2724
pub struct m8x16([i8; 16]);

Diff for: tests/assembly/simd-intrinsic-gather.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86-avx512
23
//@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
@@ -9,12 +10,8 @@
910
#![no_core]
1011
#![allow(non_camel_case_types)]
1112

12-
// Because we don't have core yet.
13-
#[lang = "sized"]
14-
pub trait Sized {}
15-
16-
#[lang = "copy"]
17-
trait Copy {}
13+
extern crate minicore;
14+
use minicore::*;
1815

1916
#[repr(simd)]
2017
pub struct f64x4([f64; 4]);

Diff for: tests/assembly/simd-intrinsic-mask-load.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86-avx2 x86-avx512
23
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86-avx2] compile-flags: -C target-feature=+avx2
@@ -12,13 +13,8 @@
1213
#![no_core]
1314
#![allow(non_camel_case_types)]
1415

15-
// Because we don't have core yet.
16-
#[lang = "sized"]
17-
pub trait Sized {}
18-
19-
#[lang = "copy"]
20-
trait Copy {}
21-
impl<T: ?Sized> Copy for *const T {}
16+
extern crate minicore;
17+
use minicore::*;
2218

2319
#[repr(simd)]
2420
pub struct i8x16([i8; 16]);

Diff for: tests/assembly/simd-intrinsic-mask-reduce.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// verify that simd mask reductions do not introduce additional bit shift operations
2+
//@ add-core-stubs
23
//@ revisions: x86 aarch64
34
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
45
// Set the base cpu explicitly, in case the default has been changed.
@@ -13,12 +14,8 @@
1314
#![no_core]
1415
#![allow(non_camel_case_types)]
1516

16-
// Because we don't have core yet.
17-
#[lang = "sized"]
18-
pub trait Sized {}
19-
20-
#[lang = "copy"]
21-
trait Copy {}
17+
extern crate minicore;
18+
use minicore::*;
2219

2320
#[repr(simd)]
2421
pub struct mask8x16([i8; 16]);

Diff for: tests/assembly/simd-intrinsic-mask-store.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86-avx2 x86-avx512
23
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86-avx2] compile-flags: -C target-feature=+avx2
@@ -12,13 +13,8 @@
1213
#![no_core]
1314
#![allow(non_camel_case_types)]
1415

15-
// Because we don't have core yet.
16-
#[lang = "sized"]
17-
pub trait Sized {}
18-
19-
#[lang = "copy"]
20-
trait Copy {}
21-
impl<T: ?Sized> Copy for *mut T {}
16+
extern crate minicore;
17+
use minicore::*;
2218

2319
#[repr(simd)]
2420
pub struct i8x16([i8; 16]);

Diff for: tests/assembly/simd-intrinsic-scatter.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86-avx512
23
//@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
@@ -9,12 +10,8 @@
910
#![no_core]
1011
#![allow(non_camel_case_types)]
1112

12-
// Because we don't have core yet.
13-
#[lang = "sized"]
14-
pub trait Sized {}
15-
16-
#[lang = "copy"]
17-
trait Copy {}
13+
extern crate minicore;
14+
use minicore::*;
1815

1916
#[repr(simd)]
2017
pub struct f64x4([f64; 4]);

Diff for: tests/assembly/simd-intrinsic-select.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86-avx2 x86-avx512 aarch64
23
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
34
//@ [x86-avx2] compile-flags: -C target-feature=+avx2
@@ -14,12 +15,8 @@
1415
#![no_core]
1516
#![allow(non_camel_case_types)]
1617

17-
// Because we don't have core yet.
18-
#[lang = "sized"]
19-
pub trait Sized {}
20-
21-
#[lang = "copy"]
22-
trait Copy {}
18+
extern crate minicore;
19+
use minicore::*;
2320

2421
#[repr(simd)]
2522
pub struct i8x16([i8; 16]);

Diff for: tests/assembly/sparc-struct-abi.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
// - float structure members are passes in floating point registers
33
// (#86163)
44

5+
//@ add-core-stubs
56
//@ assembly-output: emit-asm
67
//@ needs-llvm-components: sparc
78
//@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3
89
#![crate_type = "lib"]
910
#![feature(no_core, lang_items)]
1011
#![no_core]
1112

12-
#[lang = "sized"]
13-
pub trait Sized {}
14-
#[lang = "copy"]
15-
pub trait Copy {}
16-
impl Copy for f32 {}
13+
extern crate minicore;
14+
use minicore::*;
1715

1816
#[repr(C)]
1917
pub struct Franta {

Diff for: tests/assembly/stack-probes.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ add-core-stubs
12
//@ revisions: x86_64 i686 aarch64
23
//@ assembly-output: emit-asm
34
//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
@@ -11,12 +12,8 @@
1112
#![crate_type = "lib"]
1213
#![no_core]
1314

14-
#[lang = "sized"]
15-
trait Sized {}
16-
#[lang = "copy"]
17-
trait Copy {}
18-
19-
impl Copy for u8 {}
15+
extern crate minicore;
16+
use minicore::*;
2017

2118
// Check that inline-asm stack probes are generated correctly.
2219
// To avoid making this test fragile to slight asm changes,

Diff for: tests/assembly/stack-protector/stack-protector-target-support.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Test that stack smash protection code is emitted for all tier1 and tier2
22
// targets, with the exception of nvptx64-nvidia-cuda
33
//
4+
//@ add-core-stubs
45
//@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23
56
//@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44
67
//@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65
@@ -183,10 +184,8 @@
183184
#![crate_type = "lib"]
184185
#![no_core]
185186

186-
#[lang = "sized"]
187-
trait Sized {}
188-
#[lang = "copy"]
189-
trait Copy {}
187+
extern crate minicore;
188+
use minicore::*;
190189

191190
#[no_mangle]
192191
pub fn foo() {

0 commit comments

Comments
 (0)