Skip to content

Commit e2ba6f3

Browse files
nikomatsakispczarn
authored andcommitted
Add invariance marker to raw table
1 parent 92b4ae9 commit e2ba6f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libstd/collections/hashmap/table.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use option::{Some, None, Option};
2222
use ptr::{RawPtr, copy_nonoverlapping_memory, zero_memory};
2323
use ptr;
2424
use rt::heap::{allocate, deallocate};
25+
use core::kinds::marker;
2526

2627
static EMPTY_BUCKET: u64 = 0u64;
2728

@@ -66,6 +67,7 @@ pub struct RawTable<K, V> {
6667
capacity: uint,
6768
size: uint,
6869
hashes: *mut u64,
70+
marker: marker::InvariantType<(K,V)>,
6971
}
7072

7173
struct RawBucket<K, V> {
@@ -588,6 +590,7 @@ impl<K, V> RawTable<K, V> {
588590
size: 0,
589591
capacity: 0,
590592
hashes: 0 as *mut u64,
593+
marker: marker::InvariantType,
591594
};
592595
}
593596
// No need for `checked_mul` before a more restrictive check performed
@@ -625,6 +628,7 @@ impl<K, V> RawTable<K, V> {
625628
capacity: capacity,
626629
size: 0,
627630
hashes: hashes,
631+
marker: marker::InvariantType,
628632
}
629633
}
630634

0 commit comments

Comments
 (0)