about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-03-01 12:19:22 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-03-01 12:19:22 +0100
commit27a5f4f4727db27db8cbf37ca74cb7ea4f9a820b (patch)
tree75737a8a02ddf7e734a871fe045555ace610bc60 /example
parent86c594426f247ae34ef12f5e4dfd97f5ffe093c8 (diff)
downloadrust-27a5f4f4727db27db8cbf37ca74cb7ea4f9a820b.tar.gz
rust-27a5f4f4727db27db8cbf37ca74cb7ea4f9a820b.zip
Update Cranelift
Fixes #1143
Diffstat (limited to 'example')
-rw-r--r--example/mini_core.rs16
-rw-r--r--example/mini_core_hello_world.rs3
2 files changed, 19 insertions, 0 deletions
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 <T: PartialEq> PartialEq for Option<T> {
     }
 }
 
+#[lang = "shl"]
+pub trait Shl<RHS = Self> {
+    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);