Merge pull request #639 from madhav-madhusoodanan/test_update_mini_core
Cleaned up tests by bringing objects under `mini_core` into scope
This commit is contained in:
commit
499de70f3a
21 changed files with 124 additions and 968 deletions
|
@ -51,6 +51,10 @@ impl<T: ?Sized> LegacyReceiver for &T {}
|
|||
impl<T: ?Sized> LegacyReceiver for &mut T {}
|
||||
impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "copy"]
|
||||
pub trait Copy {}
|
||||
|
||||
|
@ -139,6 +143,14 @@ impl Mul for usize {
|
|||
}
|
||||
}
|
||||
|
||||
impl Mul for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
self * rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "add"]
|
||||
pub trait Add<RHS = Self> {
|
||||
type Output;
|
||||
|
@ -162,6 +174,14 @@ impl Add for i8 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Add for i32 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for usize {
|
||||
type Output = Self;
|
||||
|
||||
|
@ -193,6 +213,14 @@ impl Sub for usize {
|
|||
}
|
||||
}
|
||||
|
||||
impl Sub for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for u8 {
|
||||
type Output = Self;
|
||||
|
||||
|
@ -588,70 +616,43 @@ pub union MaybeUninit<T> {
|
|||
|
||||
pub mod intrinsics {
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
pub fn abort() -> !;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn size_of<T>() -> usize {
|
||||
loop {}
|
||||
}
|
||||
pub fn size_of<T>() -> usize;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn size_of_val<T: ?::Sized>(_val: *const T) -> usize {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn size_of_val<T: ?::Sized>(_val: *const T) -> usize;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn min_align_of<T>() -> usize {
|
||||
loop {}
|
||||
}
|
||||
pub fn min_align_of<T>() -> usize;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn min_align_of_val<T: ?::Sized>(_val: *const T) -> usize {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn min_align_of_val<T: ?::Sized>(_val: *const T) -> usize;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn copy<T>(_src: *const T, _dst: *mut T, _count: usize) {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn copy<T>(_src: *const T, _dst: *mut T, _count: usize);
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn transmute<T, U>(_e: T) -> U {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn transmute<T, U>(_e: T) -> U;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn ctlz_nonzero<T>(_x: T) -> u32 {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn ctlz_nonzero<T>(_x: T) -> u32;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn needs_drop<T: ?::Sized>() -> bool {
|
||||
loop {}
|
||||
}
|
||||
pub fn needs_drop<T: ?::Sized>() -> bool;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn bitreverse<T>(_x: T) -> T {
|
||||
loop {}
|
||||
}
|
||||
pub fn bitreverse<T>(_x: T) -> T;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn bswap<T>(_x: T) -> T {
|
||||
loop {}
|
||||
}
|
||||
pub fn bswap<T>(_x: T) -> T;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn write_bytes<T>(_dst: *mut T, _val: u8, _count: usize) {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn write_bytes<T>(_dst: *mut T, _val: u8, _count: usize);
|
||||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub unsafe fn unreachable() -> ! {
|
||||
loop {}
|
||||
}
|
||||
pub unsafe fn unreachable() -> !;
|
||||
}
|
||||
|
||||
pub mod libc {
|
||||
|
@ -664,6 +665,10 @@ pub mod libc {
|
|||
pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
|
||||
pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
|
||||
pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
|
||||
pub fn fflush(stream: *mut i32) -> i32;
|
||||
pub fn exit(status: i32);
|
||||
|
||||
pub static stdout: *mut i32;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,47 +3,12 @@
|
|||
// Run-time:
|
||||
// status: signal
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
mod intrinsics {
|
||||
use super::Sized;
|
||||
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
fn test_fail() -> ! {
|
||||
unsafe { intrinsics::abort() };
|
||||
|
|
|
@ -3,47 +3,12 @@
|
|||
// Run-time:
|
||||
// status: signal
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
mod intrinsics {
|
||||
use super::Sized;
|
||||
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
fn fail() -> i32 {
|
||||
unsafe { intrinsics::abort() };
|
||||
|
|
|
@ -8,19 +8,11 @@
|
|||
// 10
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
pub fn puts(s: *const u8) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
static mut ONE: usize = 1;
|
||||
|
||||
|
|
|
@ -5,132 +5,12 @@
|
|||
// 7 8
|
||||
// 10
|
||||
|
||||
#![allow(internal_features, unused_attributes)]
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs, track_caller)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
impl Copy for *mut i32 {}
|
||||
impl Copy for usize {}
|
||||
impl Copy for u8 {}
|
||||
impl Copy for i8 {}
|
||||
impl Copy for i32 {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
#[lang = "panic_location"]
|
||||
struct PanicLocation {
|
||||
file: &'static str,
|
||||
line: u32,
|
||||
column: u32,
|
||||
}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn puts(s: *const u8) -> i32;
|
||||
pub fn fflush(stream: *mut i32) -> i32;
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
|
||||
pub static stdout: *mut i32;
|
||||
}
|
||||
}
|
||||
|
||||
mod intrinsics {
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "panic"]
|
||||
#[track_caller]
|
||||
#[no_mangle]
|
||||
pub fn panic(_msg: &'static str) -> ! {
|
||||
unsafe {
|
||||
libc::puts("Panicking\0" as *const str as *const u8);
|
||||
libc::fflush(libc::stdout);
|
||||
intrinsics::abort();
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "add"]
|
||||
trait Add<RHS = Self> {
|
||||
type Output;
|
||||
|
||||
fn add(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Add for u8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i32 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for usize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[lang = "panic_const_add_overflow"]
|
||||
pub fn panic_const_add_overflow() -> ! {
|
||||
panic("attempt to add with overflow");
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
fn inc_ref(num: &mut isize) -> isize {
|
||||
*num = *num + 5;
|
||||
|
@ -141,7 +21,6 @@ fn inc(num: isize) -> isize {
|
|||
num + 1
|
||||
}
|
||||
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
argc = inc(argc);
|
||||
|
|
|
@ -9,54 +9,37 @@
|
|||
// Both args: 11
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
let string = "Arg: %d\n\0";
|
||||
let mut closure = || {
|
||||
unsafe {
|
||||
libc::printf(string as *const str as *const i8, argc);
|
||||
}
|
||||
let mut closure = || unsafe {
|
||||
libc::printf(string as *const str as *const i8, argc);
|
||||
};
|
||||
closure();
|
||||
|
||||
let mut closure = || {
|
||||
unsafe {
|
||||
libc::printf("Argument: %d\n\0" as *const str as *const i8, argc);
|
||||
}
|
||||
let mut closure = || unsafe {
|
||||
libc::printf("Argument: %d\n\0" as *const str as *const i8, argc);
|
||||
};
|
||||
closure();
|
||||
|
||||
let mut closure = |string| {
|
||||
unsafe {
|
||||
libc::printf(string as *const str as *const i8, argc);
|
||||
}
|
||||
let mut closure = |string| unsafe {
|
||||
libc::printf(string as *const str as *const i8, argc);
|
||||
};
|
||||
closure("String arg: %d\n\0");
|
||||
|
||||
let mut closure = |arg: isize| {
|
||||
unsafe {
|
||||
libc::printf("Int argument: %d\n\0" as *const str as *const i8, arg);
|
||||
}
|
||||
let mut closure = |arg: isize| unsafe {
|
||||
libc::printf("Int argument: %d\n\0" as *const str as *const i8, arg);
|
||||
};
|
||||
closure(argc + 1);
|
||||
|
||||
let mut closure = |string, arg: isize| {
|
||||
unsafe {
|
||||
libc::printf(string as *const str as *const i8, arg);
|
||||
}
|
||||
let mut closure = |string, arg: isize| unsafe {
|
||||
libc::printf(string as *const str as *const i8, arg);
|
||||
};
|
||||
closure("Both args: %d\n\0", argc + 10);
|
||||
|
||||
|
|
|
@ -6,18 +6,11 @@
|
|||
// 1
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
@ -26,15 +19,14 @@ fn main(argc: isize, _argv: *const *const u8) -> isize {
|
|||
libc::printf(b"true\n\0" as *const u8 as *const i8);
|
||||
}
|
||||
|
||||
let string =
|
||||
match argc {
|
||||
1 => b"1\n\0",
|
||||
2 => b"2\n\0",
|
||||
3 => b"3\n\0",
|
||||
4 => b"4\n\0",
|
||||
5 => b"5\n\0",
|
||||
_ => b"_\n\0",
|
||||
};
|
||||
let string = match argc {
|
||||
1 => b"1\n\0",
|
||||
2 => b"2\n\0",
|
||||
3 => b"3\n\0",
|
||||
4 => b"4\n\0",
|
||||
5 => b"5\n\0",
|
||||
_ => b"_\n\0",
|
||||
};
|
||||
libc::printf(string as *const u8 as *const i8);
|
||||
}
|
||||
0
|
||||
|
|
|
@ -3,36 +3,12 @@
|
|||
// Run-time:
|
||||
// status: 0
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
|
@ -3,43 +3,12 @@
|
|||
// Run-time:
|
||||
// status: 2
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn exit(status: i32);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
|
@ -3,36 +3,12 @@
|
|||
// Run-time:
|
||||
// status: 1
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
|
||||
#![feature(const_black_box)]
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
use std::hint::black_box;
|
||||
|
||||
|
|
|
@ -5,18 +5,11 @@
|
|||
// stdout: 1
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
fn i16_as_i8(a: i16) -> i8 {
|
||||
a as i8
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
|
||||
#![feature(const_black_box)]
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
use std::hint::black_box;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// Compiler:
|
||||
//
|
||||
// Run-time:
|
||||
|
@ -7,141 +6,19 @@
|
|||
// 6
|
||||
// 11
|
||||
|
||||
#![allow(internal_features, unused_attributes)]
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs, track_caller)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
impl Copy for *mut i32 {}
|
||||
impl Copy for usize {}
|
||||
impl Copy for u8 {}
|
||||
impl Copy for i8 {}
|
||||
impl Copy for i32 {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
#[lang = "panic_location"]
|
||||
struct PanicLocation {
|
||||
file: &'static str,
|
||||
line: u32,
|
||||
column: u32,
|
||||
}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn puts(s: *const u8) -> i32;
|
||||
pub fn fflush(stream: *mut i32) -> i32;
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
|
||||
pub static stdout: *mut i32;
|
||||
}
|
||||
}
|
||||
|
||||
mod intrinsics {
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "panic"]
|
||||
#[track_caller]
|
||||
#[no_mangle]
|
||||
pub fn panic(_msg: &'static str) -> ! {
|
||||
unsafe {
|
||||
libc::puts("Panicking\0" as *const str as *const u8);
|
||||
libc::fflush(libc::stdout);
|
||||
intrinsics::abort();
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "add"]
|
||||
trait Add<RHS = Self> {
|
||||
type Output;
|
||||
|
||||
fn add(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Add for u8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i32 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for usize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[lang = "panic_const_add_overflow"]
|
||||
pub fn panic_const_add_overflow() -> ! {
|
||||
panic("attempt to add with overflow");
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
struct Test {
|
||||
field: isize,
|
||||
}
|
||||
|
||||
fn test(num: isize) -> Test {
|
||||
Test {
|
||||
field: num + 1,
|
||||
}
|
||||
Test { field: num + 1 }
|
||||
}
|
||||
|
||||
fn update_num(num: &mut isize) {
|
||||
|
|
|
@ -5,231 +5,12 @@
|
|||
// 39
|
||||
// 10
|
||||
|
||||
#![allow(internal_features, unused_attributes)]
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, arbitrary_self_types, rustc_attrs)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
impl Copy for *mut i32 {}
|
||||
impl Copy for usize {}
|
||||
impl Copy for u8 {}
|
||||
impl Copy for i8 {}
|
||||
impl Copy for i16 {}
|
||||
impl Copy for i32 {}
|
||||
|
||||
#[lang = "deref"]
|
||||
pub trait Deref {
|
||||
type Target: ?Sized;
|
||||
|
||||
fn deref(&self) -> &Self::Target;
|
||||
}
|
||||
|
||||
#[lang = "legacy_receiver"]
|
||||
trait LegacyReceiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
#[lang = "panic_location"]
|
||||
struct PanicLocation {
|
||||
file: &'static str,
|
||||
line: u32,
|
||||
column: u32,
|
||||
}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
pub fn puts(s: *const u8) -> i32;
|
||||
pub fn fflush(stream: *mut i32) -> i32;
|
||||
|
||||
pub static stdout: *mut i32;
|
||||
}
|
||||
}
|
||||
|
||||
mod intrinsics {
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "panic"]
|
||||
#[track_caller]
|
||||
#[no_mangle]
|
||||
pub fn panic(_msg: &'static str) -> ! {
|
||||
unsafe {
|
||||
libc::puts("Panicking\0" as *const str as *const u8);
|
||||
libc::fflush(libc::stdout);
|
||||
intrinsics::abort();
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "add"]
|
||||
trait Add<RHS = Self> {
|
||||
type Output;
|
||||
|
||||
fn add(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Add for u8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i8 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for i32 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for usize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
self + rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "sub"]
|
||||
pub trait Sub<RHS = Self> {
|
||||
type Output;
|
||||
|
||||
fn sub(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Sub for usize {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for u8 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for i8 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for i16 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
self - rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "mul"]
|
||||
pub trait Mul<RHS = Self> {
|
||||
type Output;
|
||||
|
||||
#[must_use]
|
||||
fn mul(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
impl Mul for u8 {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
self * rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for usize {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
self * rhs
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul for isize {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self::Output {
|
||||
self * rhs
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[lang = "panic_const_add_overflow"]
|
||||
pub fn panic_const_add_overflow() -> ! {
|
||||
panic("attempt to add with overflow");
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[lang = "panic_const_sub_overflow"]
|
||||
pub fn panic_const_sub_overflow() -> ! {
|
||||
panic("attempt to subtract with overflow");
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[lang = "panic_const_mul_overflow"]
|
||||
pub fn panic_const_mul_overflow() -> ! {
|
||||
panic("attempt to multiply with overflow");
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
|
@ -5,18 +5,11 @@
|
|||
// stdout: 1
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
static mut ONE: usize = 1;
|
||||
|
||||
|
|
|
@ -6,53 +6,12 @@
|
|||
// 10
|
||||
// 42
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "copy"]
|
||||
pub unsafe trait Copy {}
|
||||
|
||||
impl Copy for bool {}
|
||||
impl Copy for u8 {}
|
||||
impl Copy for u16 {}
|
||||
impl Copy for u32 {}
|
||||
impl Copy for u64 {}
|
||||
impl Copy for usize {}
|
||||
impl Copy for i8 {}
|
||||
impl Copy for i16 {}
|
||||
impl Copy for i32 {}
|
||||
impl Copy for isize {}
|
||||
impl Copy for f32 {}
|
||||
impl Copy for char {}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "legacy_receiver"]
|
||||
trait LegacyReceiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize, u8, u32) {
|
||||
(
|
||||
|
|
|
@ -5,25 +5,16 @@
|
|||
// stdout: 5
|
||||
|
||||
#![feature(no_core, start)]
|
||||
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
extern crate mini_core;
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
use mini_core::*;
|
||||
|
||||
static mut TWO: usize = 2;
|
||||
|
||||
fn index_slice(s: &[u32]) -> u32 {
|
||||
unsafe {
|
||||
s[TWO]
|
||||
}
|
||||
unsafe { s[TWO] }
|
||||
}
|
||||
|
||||
#[start]
|
||||
|
|
|
@ -9,72 +9,12 @@
|
|||
// 12
|
||||
// 1
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "destruct"]
|
||||
pub trait Destruct {}
|
||||
|
||||
#[lang = "drop"]
|
||||
pub trait Drop {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
impl<T: ?Sized> Copy for *mut T {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
mod intrinsics {
|
||||
use super::Sized;
|
||||
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_intrinsic_must_be_overridden]
|
||||
pub fn abort() -> ! {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "structural_peq"]
|
||||
pub trait StructuralPartialEq {}
|
||||
|
||||
#[lang = "drop_in_place"]
|
||||
#[allow(unconditional_recursion)]
|
||||
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
// Code here does not matter - this is replaced by the
|
||||
// real drop glue by the compiler.
|
||||
drop_in_place(to_drop);
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
struct Test {
|
||||
field: isize,
|
||||
|
@ -86,17 +26,11 @@ struct WithRef {
|
|||
|
||||
static mut CONSTANT: isize = 10;
|
||||
|
||||
static mut TEST: Test = Test {
|
||||
field: 12,
|
||||
};
|
||||
static mut TEST: Test = Test { field: 12 };
|
||||
|
||||
static mut TEST2: Test = Test {
|
||||
field: 14,
|
||||
};
|
||||
static mut TEST2: Test = Test { field: 14 };
|
||||
|
||||
static mut WITH_REF: WithRef = WithRef {
|
||||
refe: unsafe { &TEST },
|
||||
};
|
||||
static mut WITH_REF: WithRef = WithRef { refe: unsafe { &TEST } };
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
|
@ -5,43 +5,12 @@
|
|||
// stdout: 1
|
||||
// 2
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
struct Test {
|
||||
field: isize,
|
||||
|
@ -57,12 +26,8 @@ fn one() -> isize {
|
|||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
let test = Test {
|
||||
field: one(),
|
||||
};
|
||||
let two = Two {
|
||||
two: 2,
|
||||
};
|
||||
let test = Test { field: one() };
|
||||
let two = Two { two: 2 };
|
||||
unsafe {
|
||||
libc::printf(b"%ld\n\0" as *const u8 as *const i8, test.field);
|
||||
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);
|
||||
|
|
|
@ -4,43 +4,12 @@
|
|||
// status: 0
|
||||
// stdout: 3
|
||||
|
||||
#![feature(auto_traits, lang_items, no_core, start, intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
#![feature(no_core, start)]
|
||||
#![no_std]
|
||||
#![no_core]
|
||||
|
||||
/*
|
||||
* Core
|
||||
*/
|
||||
|
||||
// Because we don't have core yet.
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
#[lang = "copy"]
|
||||
trait Copy {
|
||||
}
|
||||
|
||||
impl Copy for isize {}
|
||||
|
||||
#[lang = "receiver"]
|
||||
trait Receiver {
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub(crate) unsafe auto trait Freeze {}
|
||||
|
||||
mod libc {
|
||||
#[link(name = "c")]
|
||||
extern "C" {
|
||||
pub fn printf(format: *const i8, ...) -> i32;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code
|
||||
*/
|
||||
extern crate mini_core;
|
||||
use mini_core::*;
|
||||
|
||||
#[start]
|
||||
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue