Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use add-core-stubs / minicore for a few more tests #137145

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions tests/assembly/asm/aarch64-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#![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, lang_items)]

extern crate minicore;
use minicore::*;
Expand Down Expand Up @@ -63,12 +61,6 @@ impl Copy for f16x8 {}
impl Copy for f32x4 {}
impl Copy for f64x2 {}

// FIXME(f16_f128): Only needed for FIXME in check! and check_reg!
#[lang = "freeze"]
unsafe auto trait Freeze {}
#[lang = "unpin"]
auto trait Unpin {}

extern "C" {
fn extern_func();
static extern_static: u8;
Expand Down
22 changes: 20 additions & 2 deletions tests/auxiliary/minicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,20 @@
//! <https://github.com/rust-lang/rust/blob/c0b5cc9003f6464c11ae1c0662c6a7e06f6f5cab/compiler/rustc_codegen_cranelift/example/mini_core.rs>.
// ignore-tidy-linelength

#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions, f16, f128)]
#![feature(
no_core,
lang_items,
auto_traits,
freeze_impls,
negative_impls,
rustc_attrs,
decl_macro,
naked_functions,
f16,
f128,
asm_experimental_arch
)]
#![allow(unused, improper_ctypes_definitions, internal_features)]
#![feature(asm_experimental_arch)]
#![no_std]
#![no_core]

Expand All @@ -42,6 +53,12 @@ pub trait Copy: Sized {}
#[lang = "bikeshed_guaranteed_no_drop"]
pub trait BikeshedGuaranteedNoDrop {}

#[lang = "freeze"]
pub unsafe auto trait Freeze {}

#[lang = "unpin"]
pub auto trait Unpin {}

impl_marker_trait!(
Copy => [
bool, char,
Expand Down Expand Up @@ -83,6 +100,7 @@ impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {}
pub struct UnsafeCell<T: ?Sized> {
value: T,
}
impl<T: ?Sized> !Freeze for UnsafeCell<T> {}

#[rustc_builtin_macro]
pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
Expand Down
7 changes: 4 additions & 3 deletions tests/codegen/abi-win64-zst.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: -Z merge-functions=disabled
//@ add-core-stubs

//@ revisions: windows-gnu
//@[windows-gnu] compile-flags: --target x86_64-pc-windows-gnu
Expand All @@ -13,12 +14,12 @@
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
//@[linux] needs-llvm-components: x86

#![feature(no_core, lang_items, rustc_attrs, abi_vectorcall)]
#![feature(no_core, rustc_attrs, abi_vectorcall)]
#![no_core]
#![crate_type = "lib"]

#[lang = "sized"]
trait Sized {}
extern crate minicore;
use minicore::*;

// Make sure the argument is always passed when explicitly requesting a Windows ABI.
// Our goal here is to match clang: <https://clang.godbolt.org/z/Wr4jMWq3P>.
Expand Down
11 changes: 4 additions & 7 deletions tests/codegen/align-byval-alignment-mismatch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-tidy-linelength
//@ add-core-stubs
//@ revisions:i686-linux x86_64-linux

//@[i686-linux] compile-flags: --target i686-unknown-linux-gnu -C panic=abort
Expand All @@ -16,18 +17,14 @@
// on i686-unknown-linux-gnu, since the alignment needs to be increased, and should codegen
// to a direct call on x86_64-unknown-linux-gnu, where byval alignment matches Rust alignment.

#![feature(no_core, lang_items)]
#![feature(no_core)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#![allow(non_camel_case_types)]

#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
extern crate minicore;
use minicore::*;

// This type has align 1 in Rust, but as a byval argument on i686-linux, it will have align 4.
#[repr(C)]
Expand Down
11 changes: 4 additions & 7 deletions tests/codegen/align-byval-vector.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions:x86-linux x86-darwin

//@[x86-linux] compile-flags: --target i686-unknown-linux-gnu
Expand All @@ -7,18 +8,14 @@

// Tests that aggregates containing vector types get their alignment increased to 16 on Darwin.

#![feature(no_core, lang_items, repr_simd, simd_ffi)]
#![feature(no_core, repr_simd, simd_ffi)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#![allow(non_camel_case_types)]

#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct i32x4([i32; 4]);
Expand Down
14 changes: 4 additions & 10 deletions tests/codegen/align-byval.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-tidy-linelength
//@ add-core-stubs
//@ revisions:m68k x86_64-linux x86_64-windows i686-linux i686-windows

//@[m68k] compile-flags: --target m68k-unknown-linux-gnu
Expand All @@ -16,20 +17,13 @@
// The only targets that use `byval` are m68k, x86-64, and x86.
// Note also that Windows mandates a by-ref ABI here, so it does not use byval.

#![feature(no_core, lang_items)]
#![feature(no_core)]
#![crate_type = "lib"]
#![no_std]
#![no_core]

#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}

impl Copy for i32 {}
impl Copy for i64 {}
extern crate minicore;
use minicore::*;

// This struct can be represented as a pair, so it exercises the OperandValue::Pair
// codepath in `codegen_argument`.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.aarch64-darwin.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.powerpc-linux.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
7 changes: 4 additions & 3 deletions tests/ui/abi/c-zst.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
/*!
C doesn't have zero-sized types... except it does.
Expand Down Expand Up @@ -52,12 +53,12 @@ extern "C" fn(i32, (), i32);
//@[x86_64-pc-windows-gnu] needs-llvm-components: x86


#![feature(lang_items, no_core, rustc_attrs)]
#![feature(no_core, rustc_attrs)]
#![no_core]
#![crate_type = "lib"]

#[lang = "sized"]
trait Sized {}
extern crate minicore;
use minicore::*;

#[rustc_abi(debug)]
extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.s390x-linux.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.sparc64-linux.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.x86_64-linux.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi {
conv: C,
can_unwind: false,
}
--> $DIR/c-zst.rs:63:1
--> $DIR/c-zst.rs:64:1
|
LL | extern "C" fn pass_zst(_: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
9 changes: 4 additions & 5 deletions tests/ui/simd-abi-checks-empty-list.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
//@ add-core-stubs
//@ needs-llvm-components: sparc
//@ compile-flags: --target=sparc-unknown-none-elf --crate-type=rlib
//@ build-pass
//@ ignore-pass (test emits codegen-time warnings)
#![no_core]
#![feature(no_core, lang_items, repr_simd)]
#![feature(no_core, repr_simd)]
#![allow(improper_ctypes_definitions)]
#[lang = "sized"]
trait Sized {}

#[lang = "copy"]
trait Copy {}
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct SimdVec([i32; 4]);
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/simd-abi-checks-empty-list.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
--> $DIR/simd-abi-checks-empty-list.rs:17:1
--> $DIR/simd-abi-checks-empty-list.rs:16:1
|
LL | pub extern "C" fn pass_by_vec(_: SimdVec) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
Expand All @@ -12,7 +12,7 @@ warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
--> $DIR/simd-abi-checks-empty-list.rs:17:1
--> $DIR/simd-abi-checks-empty-list.rs:16:1
|
LL | pub extern "C" fn pass_by_vec(_: SimdVec) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
Expand Down
15 changes: 4 additions & 11 deletions tests/ui/simd-abi-checks-s390x.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: z10 z13_no_vector z13_soft_float
//@ build-fail
//@[z10] compile-flags: --target s390x-unknown-linux-gnu
Expand All @@ -8,20 +9,14 @@
//@[z13_soft_float] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector,+soft-float
//@[z13_soft_float] needs-llvm-components: systemz

#![feature(no_core, lang_items, repr_simd, s390x_target_feature)]
#![feature(no_core, repr_simd, s390x_target_feature)]
#![no_core]
#![crate_type = "lib"]
#![allow(non_camel_case_types, improper_ctypes_definitions)]
#![deny(abi_unsupported_vector_types)]

#[lang = "sized"]
pub trait Sized {}
#[lang = "copy"]
pub trait Copy {}
#[lang = "freeze"]
pub trait Freeze {}

impl<T: Copy, const N: usize> Copy for [T; N] {}
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct i8x8([i8; 8]);
Expand All @@ -34,8 +29,6 @@ pub struct Wrapper<T>(T);
#[repr(transparent)]
pub struct TransparentWrapper<T>(T);

impl Copy for i8 {}
impl Copy for i64 {}
impl Copy for i8x8 {}
impl Copy for i8x16 {}
impl Copy for i8x32 {}
Expand Down
Loading
Loading