mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
adding minicore to test file to avoid duplicating lang error
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -210,6 +210,14 @@ fn neg(self) -> 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_ {}
|
||||
|
||||
Reference in New Issue
Block a user