diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-04-18 21:19:50 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-04-18 21:20:11 +0200 |
| commit | e4ea67b3d79bb8d9dbab383ec93edc4ea8cc8df4 (patch) | |
| tree | 76be0d256a5a2430eb00637388161b70b639d3b9 /compiler/rustc_codegen_gcc/example | |
| parent | 191df20fcad9331d3a948aa8e8556775ec3fe69d (diff) | |
| parent | db1a31c243a649e1fe20f5466ba181da5be35c14 (diff) | |
| download | rust-e4ea67b3d79bb8d9dbab383ec93edc4ea8cc8df4.tar.gz rust-e4ea67b3d79bb8d9dbab383ec93edc4ea8cc8df4.zip | |
Merge commit 'db1a31c243a649e1fe20f5466ba181da5be35c14' into subtree-update_cg_gcc_2025-04-18
Diffstat (limited to 'compiler/rustc_codegen_gcc/example')
| -rw-r--r-- | compiler/rustc_codegen_gcc/example/mini_core.rs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 5544aee9eaf..c554a87b825 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/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 {} @@ -134,6 +138,14 @@ impl Mul for u8 { } } +impl Mul for i32 { + type Output = Self; + + fn mul(self, rhs: Self) -> Self::Output { + self * rhs + } +} + impl Mul for usize { type Output = Self; @@ -142,6 +154,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; @@ -165,6 +185,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; @@ -196,6 +224,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; @@ -220,6 +256,14 @@ impl Sub for i16 { } } +impl Sub for i32 { + type Output = Self; + + fn sub(self, rhs: Self) -> Self { + self - rhs + } +} + #[lang = "rem"] pub trait Rem<RHS = Self> { type Output; @@ -628,6 +672,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; } } |
