about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadhav Madhusoodanan <f20200049@pilani.bits-pilani.ac.in>2025-03-08 16:47:58 +0530
committerMadhav Madhusoodanan <f20200049@pilani.bits-pilani.ac.in>2025-03-08 16:47:58 +0530
commit572da5cd261381451669d7d35c199e2227f9e6db (patch)
tree219f976606a4f4c0fba8f8db9233812a3477e9aa
parentfcac22978ad507b8a7124f0a1600ff55417a34a7 (diff)
downloadrust-572da5cd261381451669d7d35c199e2227f9e6db.tar.gz
rust-572da5cd261381451669d7d35c199e2227f9e6db.zip
cleaned up tests by bringing objects under `mini_core` into scope
-rw-r--r--example/mini_core.rs109
-rw-r--r--tests/run/abort1.rs41
-rw-r--r--tests/run/abort2.rs41
-rw-r--r--tests/run/array.rs10
-rw-r--r--tests/run/assign.rs127
-rw-r--r--tests/run/closure.rs39
-rw-r--r--tests/run/condition.rs26
-rw-r--r--tests/run/empty_main.rs30
-rw-r--r--tests/run/exit.rs37
-rw-r--r--tests/run/exit_code.rs30
-rw-r--r--tests/run/float.rs4
-rw-r--r--tests/run/fun_ptr.rs9
-rw-r--r--tests/run/int.rs4
-rw-r--r--tests/run/mut_ref.rs131
-rw-r--r--tests/run/operations.rs225
-rw-r--r--tests/run/ptr_cast.rs9
-rw-r--r--tests/run/return-tuple.rs47
-rw-r--r--tests/run/slice.rs13
-rw-r--r--tests/run/static.rs78
-rw-r--r--tests/run/structs.rs45
-rw-r--r--tests/run/tuple.rs37
21 files changed, 124 insertions, 968 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs
index bd7a4612a92..8d749c7a8f1 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -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;
     }
 }
 
diff --git a/tests/run/abort1.rs b/tests/run/abort1.rs
index 696197d7377..6561aaf25f6 100644
--- a/tests/run/abort1.rs
+++ b/tests/run/abort1.rs
@@ -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() };
diff --git a/tests/run/abort2.rs b/tests/run/abort2.rs
index 714cd6c0f38..a9f176577fc 100644
--- a/tests/run/abort2.rs
+++ b/tests/run/abort2.rs
@@ -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() };
diff --git a/tests/run/array.rs b/tests/run/array.rs
index c3c08c29c6d..b405102baff 100644
--- a/tests/run/array.rs
+++ b/tests/run/array.rs
@@ -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;
 
diff --git a/tests/run/assign.rs b/tests/run/assign.rs
index 2a47f0c2966..99a61337ada 100644
--- a/tests/run/assign.rs
+++ b/tests/run/assign.rs
@@ -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);
diff --git a/tests/run/closure.rs b/tests/run/closure.rs
index 46c47bc54ed..c8f06265c6b 100644
--- a/tests/run/closure.rs
+++ b/tests/run/closure.rs
@@ -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);
 
diff --git a/tests/run/condition.rs b/tests/run/condition.rs
index 039ef94eaa7..d3714587401 100644
--- a/tests/run/condition.rs
+++ b/tests/run/condition.rs
@@ -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
diff --git a/tests/run/empty_main.rs b/tests/run/empty_main.rs
index e66a859ad69..c4a24e9b185 100644
--- a/tests/run/empty_main.rs
+++ b/tests/run/empty_main.rs
@@ -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 {
diff --git a/tests/run/exit.rs b/tests/run/exit.rs
index bf1cbeef302..3d66d8fbdb2 100644
--- a/tests/run/exit.rs
+++ b/tests/run/exit.rs
@@ -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 {
diff --git a/tests/run/exit_code.rs b/tests/run/exit_code.rs
index be7a233efda..b18d08879f0 100644
--- a/tests/run/exit_code.rs
+++ b/tests/run/exit_code.rs
@@ -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 {
diff --git a/tests/run/float.rs b/tests/run/float.rs
index e0a57e6fed1..424fa1cf4ad 100644
--- a/tests/run/float.rs
+++ b/tests/run/float.rs
@@ -5,10 +5,6 @@
 
 #![feature(const_black_box)]
 
-/*
- * Code
- */
-
 fn main() {
     use std::hint::black_box;
 
diff --git a/tests/run/fun_ptr.rs b/tests/run/fun_ptr.rs
index ed1bf72bb27..45b4ebcd9f0 100644
--- a/tests/run/fun_ptr.rs
+++ b/tests/run/fun_ptr.rs
@@ -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
diff --git a/tests/run/int.rs b/tests/run/int.rs
index bfe73c38435..47b5dea46f8 100644
--- a/tests/run/int.rs
+++ b/tests/run/int.rs
@@ -5,10 +5,6 @@
 
 #![feature(const_black_box)]
 
-/*
- * Code
- */
-
 fn main() {
     use std::hint::black_box;
 
diff --git a/tests/run/mut_ref.rs b/tests/run/mut_ref.rs
index 3ae79338216..5c91bc96ca0 100644
--- a/tests/run/mut_ref.rs
+++ b/tests/run/mut_ref.rs
@@ -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) {
diff --git a/tests/run/operations.rs b/tests/run/operations.rs
index 0e44fc580b8..a298cf2a68d 100644
--- a/tests/run/operations.rs
+++ b/tests/run/operations.rs
@@ -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 {
diff --git a/tests/run/ptr_cast.rs b/tests/run/ptr_cast.rs
index 2b8812ad51c..eb4cf3eafd0 100644
--- a/tests/run/ptr_cast.rs
+++ b/tests/run/ptr_cast.rs
@@ -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;
 
diff --git a/tests/run/return-tuple.rs b/tests/run/return-tuple.rs
index f2a5a2e4384..c3069933e08 100644
--- a/tests/run/return-tuple.rs
+++ b/tests/run/return-tuple.rs
@@ -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) {
     (
diff --git a/tests/run/slice.rs b/tests/run/slice.rs
index fba93fc1554..6f2f8b9a9ce 100644
--- a/tests/run/slice.rs
+++ b/tests/run/slice.rs
@@ -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]
diff --git a/tests/run/static.rs b/tests/run/static.rs
index a17ea2a4893..5fc167ce4e4 100644
--- a/tests/run/static.rs
+++ b/tests/run/static.rs
@@ -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 {
diff --git a/tests/run/structs.rs b/tests/run/structs.rs
index d6455667400..641c6c71d1e 100644
--- a/tests/run/structs.rs
+++ b/tests/run/structs.rs
@@ -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);
diff --git a/tests/run/tuple.rs b/tests/run/tuple.rs
index 8a7d85ae867..1f2d24eeacc 100644
--- a/tests/run/tuple.rs
+++ b/tests/run/tuple.rs
@@ -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 {