adding minicore to test file to avoid duplicating lang error

This commit is contained in:
paradoxicalguy 2025-12-31 06:49:53 +00:00
parent 94f8f4083e
commit 484ea769d3
2 changed files with 21 additions and 39 deletions

View file

@ -1,3 +1,4 @@
//@ add-minicore
//@ assembly-output: emit-asm
//@ revisions: riscv64 riscv64-zbb loongarch64
//@ compile-flags: -C opt-level=3
@ -14,45 +15,8 @@
#![no_std]
#![no_core]
// FIXME: Migrate these code after PR #130693 is landed.
#[lang = "pointee_sized"]
pub trait PointeeSized {}
#[lang = "meta_sized"]
pub trait MetaSized: PointeeSized {}
#[lang = "sized"]
pub trait Sized: MetaSized {}
#[lang = "copy"]
trait Copy {}
impl Copy for i8 {}
impl Copy for u32 {}
impl Copy for i32 {}
#[lang = "neg"]
trait Neg {
type Output;
fn neg(self) -> Self::Output;
}
impl Neg for i8 {
type Output = i8;
fn neg(self) -> Self::Output {
-self
}
}
#[lang = "Ordering"]
#[repr(i8)]
enum Ordering {
Less = -1,
Equal = 0,
Greater = 1,
}
extern crate minicore;
use minicore::*;
#[rustc_intrinsic]
fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering;

View file

@ -210,6 +210,14 @@ impl Neg for isize {
}
}
impl Neg for i8 {
type Output = i8;
fn neg(self) -> i8 {
loop {}
}
}
#[lang = "sync"]
trait Sync {}
impl_marker_trait!(
@ -280,6 +288,16 @@ pub enum c_void {
__variant2,
}
#[lang = "Ordering"]
#[repr(i8)]
pub enum Ordering {
Less = -1,
Equal = 0,
Greater = 1,
}
impl Copy for Ordering {}
#[lang = "const_param_ty"]
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
pub trait ConstParamTy_ {}