Skip to content

Commit

Permalink
Impls Finalize, Trace for PhantomData.
Browse files Browse the repository at this point in the history
  • Loading branch information
remexre committed Sep 24, 2017
1 parent 470b6a8 commit 763addb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ unsafe impl<T: Eq + Hash + Trace> Trace for LinkedList<T> {
});
}

impl<T> Finalize for PhantomData<T> {}
unsafe impl<T> Trace for PhantomData<T> {
unsafe_empty_trace!();
}

impl<T: Trace> Finalize for VecDeque<T> {}
unsafe impl<T: Trace> Trace for VecDeque<T> {
custom_trace!(this, {
Expand Down
12 changes: 12 additions & 0 deletions gc/tests/phantom_data.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extern crate gc;

use std::marker::PhantomData;

use gc::Gc;

enum Uninhabited {}

#[test]
fn phantom_data() {
let _x: Gc<PhantomData<Uninhabited>> = Gc::new(PhantomData);
}

0 comments on commit 763addb

Please sign in to comment.