about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2023-02-28 22:39:50 -0500
committerAntoni Boucher <bouanto@zoho.com>2023-02-28 22:39:50 -0500
commitd8b5a3eaa927c0b8730d3fb3e4cd0731bbe48813 (patch)
treeb1472ac5eac53a945aaa9cc0955d2c4a4be37990
parente74f6ff54fc6c0d266387a3f04730abd43d69901 (diff)
downloadrust-d8b5a3eaa927c0b8730d3fb3e4cd0731bbe48813.tar.gz
rust-d8b5a3eaa927c0b8730d3fb3e4cd0731bbe48813.zip
Fix to examples
-rw-r--r--example/mini_core.rs17
-rw-r--r--example/mini_core_hello_world.rs1
-rw-r--r--src/common.rs4
3 files changed, 16 insertions, 6 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs
index b23ecda35d3..637b8dc53fe 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -17,6 +17,9 @@ pub trait Sized {}
 #[lang = "destruct"]
 pub trait Destruct {}
 
+#[lang = "tuple_trait"]
+pub trait Tuple {}
+
 #[lang = "unsize"]
 pub trait Unsize<T: ?Sized> {}
 
@@ -396,7 +399,7 @@ pub struct PhantomData<T: ?Sized>;
 
 #[lang = "fn_once"]
 #[rustc_paren_sugar]
-pub trait FnOnce<Args> {
+pub trait FnOnce<Args: Tuple> {
     #[lang = "fn_once_output"]
     type Output;
 
@@ -405,7 +408,7 @@ pub trait FnOnce<Args> {
 
 #[lang = "fn_mut"]
 #[rustc_paren_sugar]
-pub trait FnMut<Args>: FnOnce<Args> {
+pub trait FnMut<Args: Tuple>: FnOnce<Args> {
     extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
 }
 
@@ -418,8 +421,8 @@ pub fn panic(_msg: &'static str) -> ! {
     }
 }
 
-#[lang = "panic_no_unwind"]
-fn panic_no_unwind() -> ! {
+#[lang = "panic_cannot_unwind"]
+fn panic_cannot_unwind() -> ! {
     unsafe {
         libc::puts("Panicking\n\0" as *const str as *const u8);
         intrinsics::abort();
@@ -531,16 +534,22 @@ pub mod intrinsics {
     use crate::Sized;
 
     extern "rust-intrinsic" {
+        #[rustc_safe_intrinsic]
         pub fn abort() -> !;
+        #[rustc_safe_intrinsic]
         pub fn size_of<T>() -> usize;
         pub fn size_of_val<T: ?Sized>(val: *const T) -> usize;
+        #[rustc_safe_intrinsic]
         pub fn min_align_of<T>() -> usize;
         pub fn min_align_of_val<T: ?Sized>(val: *const T) -> usize;
         pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
         pub fn transmute<T, U>(e: T) -> U;
         pub fn ctlz_nonzero<T>(x: T) -> T;
+        #[rustc_safe_intrinsic]
         pub fn needs_drop<T: ?Sized>() -> bool;
+        #[rustc_safe_intrinsic]
         pub fn bitreverse<T>(x: T) -> T;
+        #[rustc_safe_intrinsic]
         pub fn bswap<T>(x: T) -> T;
         pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
         pub fn unreachable() -> !;
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 7b10425e800..993a31e68ea 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -85,6 +85,7 @@ fn start<T: Termination + 'static>(
     main: fn() -> T,
     argc: isize,
     argv: *const *const u8,
+    _sigpipe: u8,
 ) -> isize {
     if argc == 3 {
         unsafe { puts(*argv); }
diff --git a/src/common.rs b/src/common.rs
index 54325e1277b..12c0b392323 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -115,8 +115,8 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         self.const_uint(self.usize_type, i)
     }
 
-    fn const_u8(&self, _i: u8) -> RValue<'gcc> {
-        unimplemented!();
+    fn const_u8(&self, i: u8) -> RValue<'gcc> {
+        self.const_uint(self.type_u8(), i as u64)
     }
 
     fn const_real(&self, typ: Type<'gcc>, val: f64) -> RValue<'gcc> {