Skip to content

Instantly share code, notes, and snippets.

@johnynek
Created February 24, 2015 07:31
Show Gist options
  • Select an option

  • Save johnynek/cb0081e0c84eedb8f079 to your computer and use it in GitHub Desktop.

Select an option

Save johnynek/cb0081e0c84eedb8f079 to your computer and use it in GitHub Desktop.
rust compiler error
use std::old_io as io;
use std::sync::mpsc::channel;
use std::thread::Thread;
use std::ops::Fn;
use std::marker::PhantomData;
pub struct Test<F, X>(F, PhantomData<X>);
impl <F, X> Test<F, X> where F: Fn(X) {
fn go(self, x: X) {
let Test(f, _) = self;
f(x)
}
}
fn main() {
let (tx, rx) = channel();
Thread::spawn(move|| {
tx.send(Test(|x: isize| { println!("{:?}", x) }, PhantomData)).unwrap()
});
//println!("{:?}",
rx.recv().unwrap().go(12);
}
/*
Global is external, but doesn't have external or weak linkage!
void (%closure*, i64)* @_ZN4main12closure.4347E
invalid linkage type for function declaration
void (%closure*, i64)* @_ZN4main12closure.4347E
LLVM ERROR: Broken module found, compilation aborted!
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment