Implement barrier.
auto merge of #11725 : derekchiang/rust/add-barrier, r=alexcrichton