Last active
April 17, 2018 14:36
-
-
Save MaxGraey/bf004614efaeef1dfaa07921d009a122 to your computer and use it in GitHub Desktop.
Shrink Rust wasm size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(core_intrinsics, lang_items)] | |
#![no_main] | |
#![no_std] | |
#[lang = "panic_fmt"] | |
extern "C" fn panic_fmt(_args: ::core::fmt::Arguments, _file: &'static str, _line: u32) -> ! { | |
use core::intrinsics; | |
unsafe { | |
intrinsics::abort(); | |
} | |
} | |
#[no_mangle] | |
pub extern "C" fn one() -> i32 { | |
return None.unwrap(); | |
} | |
// Compiled to wasm size shrink from 34 Kb to ~350b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment