Skip to content

Commit 89080b2

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 94fec13 + 92eb445 commit 89080b2

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

tests/assembly/aarch64-pointer-auth.rs

Lines changed: 3 additions & 2 deletions
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

tests/assembly/cmse.rs

Lines changed: 4 additions & 4 deletions
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:

tests/assembly/dwarf4.rs

Lines changed: 3 additions & 4 deletions
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

tests/assembly/dwarf5.rs

Lines changed: 3 additions & 4 deletions
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

tests/assembly/pic-relocation-model.rs

Lines changed: 3 additions & 4 deletions
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)

tests/assembly/pie-relocation-model.rs

Lines changed: 3 additions & 4 deletions
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".

tests/assembly/powerpc64-struct-abi.rs

Lines changed: 3 additions & 14 deletions
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 {}

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

Lines changed: 3 additions & 9 deletions
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

tests/assembly/s390x-backchain-toggle.rs

Lines changed: 3 additions & 2 deletions
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();

tests/assembly/simd-bitmask.rs

Lines changed: 3 additions & 6 deletions
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]);

0 commit comments

Comments
 (0)