Skip to content

Instantly share code, notes, and snippets.

@pnkfelix
Created October 2, 2019 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnkfelix/425ddc19aa968bbc36b8cb46fab7d15d to your computer and use it in GitHub Desktop.
Save pnkfelix/425ddc19aa968bbc36b8cb46fab7d15d to your computer and use it in GitHub Desktop.
#![feature(core_panic)]
#![no_std]
extern crate std;
struct Droppable;
impl Drop for Droppable {
fn drop(&mut self) {
let msg = "Dropping a Droppable\n";
extern "C" { fn putchar(b: u8); }
for c in msg.chars() {
unsafe { putchar(c as u8); }
}
}
}
fn main() {
let _guard = Droppable;
core::panicking::panic(&("???", "downstream.rs", 17, 4))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment