Skip to content

Instantly share code, notes, and snippets.

@dcchut
Created April 3, 2020 10:34
Show Gist options
  • Save dcchut/4b52ce7d0899a1a1cd99979680fd7fe9 to your computer and use it in GitHub Desktop.
Save dcchut/4b52ce7d0899a1a1cd99979680fd7fe9 to your computer and use it in GitHub Desktop.
#![feature(lang_items)]
#![feature(alloc_error_handler)]
#![no_std]
pub mod another_module;
extern crate alloc;
use alloc::boxed::Box;
use async_recursion::async_recursion;
// Use `wee_alloc` as the global allocator.
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}
#[alloc_error_handler]
fn oom(_: core::alloc::Layout) -> ! {
loop {}
}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[async_recursion]
async fn bad_adder(x: u32, y: u32) -> u32 {
if x > 0 {
1 + bad_adder(x - 1, y).await
} else if y > 0 {
1 + bad_adder(x, y - 1).await
} else {
0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment