Skip to content

Commit

Permalink
Issue #46555 - Making IndexVec Send if its contents are Send
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoric committed Dec 7, 2017
1 parent d1364a6 commit 8500fb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_data_structures/indexed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ pub struct IndexVec<I: Idx, T> {
_marker: PhantomData<Fn(&I)>
}

// Whether `IndexVec` is `Send` depends only on the data,
// not the phantom data.
unsafe impl<I: Idx, T> Send for IndexVec<I, T> where T: Send {}

impl<I: Idx, T: serialize::Encodable> serialize::Encodable for IndexVec<I, T> {
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
serialize::Encodable::encode(&self.raw, s)
Expand Down

0 comments on commit 8500fb9

Please sign in to comment.