Skip to content

Instantly share code, notes, and snippets.

@nathansobo
Created January 22, 2018 19:30
Show Gist options
  • Save nathansobo/a32a2ab5a4d063b354649089f5949671 to your computer and use it in GitHub Desktop.
Save nathansobo/a32a2ab5a4d063b354649089f5949671 to your computer and use it in GitHub Desktop.
// When compiled in debug mode with rustc 1.25.0-nightly (97520ccb1 2018-01-21),
// calling test from JS results in a `memory access out of bounds` error
// Note the dependency on the [email protected] crate
extern crate futures;
use futures::Stream;
#[no_mangle]
pub fn test() -> usize {
let (tx, rx) = futures::sync::mpsc::unbounded::<usize>();
// These lines exist just to confirm that the channels aren't getting optimized away when
// compiled in release mode. They are *not* required to reproduce the `memory access out of
// bounds` error in debug mode
tx.unbounded_send(42).unwrap();
rx.wait().next().unwrap().unwrap()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment