diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2019-03-30 18:22:43 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2019-08-01 11:49:03 +0200 |
| commit | c4af588f72c317a015f6e26bb7d25ae288096b91 (patch) | |
| tree | 0b9ac69541826462afacc3f2719017e11d66cfe7 /example | |
| parent | 2f0093b8c2f44f560dd51b26ac1c6bb902513ec7 (diff) | |
| download | rust-c4af588f72c317a015f6e26bb7d25ae288096b91.tar.gz rust-c4af588f72c317a015f6e26bb7d25ae288096b91.zip | |
Correctly align all allocs
Fixes #348
Diffstat (limited to 'example')
| -rw-r--r-- | example/mini_core.rs | 15 | ||||
| -rw-r--r-- | example/mini_core_hello_world.rs | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs index 68e056b905f..f57f1ff635d 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -186,6 +186,21 @@ impl Sub for i16 { } } +#[lang = "rem"] +pub trait Rem<RHS = Self> { + type Output; + + fn rem(self, rhs: RHS) -> Self::Output; +} + +impl Rem for usize { + type Output = Self; + + fn rem(self, rhs: Self) -> Self { + self % rhs + } +} + #[lang = "bitor"] pub trait BitOr<RHS = Self> { type Output; diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index 380bc487bcc..48ae80baaad 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -134,6 +134,10 @@ fn main() { call_return_u128_pair(); + let slice = &[0, 1] as &[i32]; + let slice_ptr = slice as *const [i32] as *const i32; + assert_eq!(slice_ptr as usize % 4, 0); + //return; unsafe { |
