From 27a5f4f4727db27db8cbf37ca74cb7ea4f9a820b Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 1 Mar 2021 12:19:22 +0100 Subject: Update Cranelift Fixes #1143 --- example/mini_core.rs | 16 ++++++++++++++++ example/mini_core_hello_world.rs | 3 +++ 2 files changed, 19 insertions(+) (limited to 'example') diff --git a/example/mini_core.rs b/example/mini_core.rs index 002ec7e2e3d..7c6d7fc106d 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -365,6 +365,22 @@ impl PartialEq for Option { } } +#[lang = "shl"] +pub trait Shl { + type Output; + + #[must_use] + fn shl(self, rhs: RHS) -> Self::Output; +} + +impl Shl for u128 { + type Output = u128; + + fn shl(self, rhs: u128) -> u128 { + self << rhs + } +} + #[lang = "neg"] pub trait Neg { type Output; diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index 4a8375afac3..237f4d11d57 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -264,6 +264,9 @@ fn main() { assert_eq!(f2 as i8, -128); assert_eq!(f2 as u8, 0); + let amount = 0; + assert_eq!(1u128 << amount, 1); + static ANOTHER_STATIC: &u8 = &A_STATIC; assert_eq!(*ANOTHER_STATIC, 42); -- cgit 1.4.1-3-g733a5