pass a test, dubiously

This commit is contained in:
Pat Hickey
2020-12-14 19:46:09 -08:00
parent c16e731455
commit 04805fcc5f
9 changed files with 400 additions and 134 deletions

View File

@@ -16,11 +16,11 @@ impl Table {
}
}
pub fn insert_at(&mut self, key: u32, a: impl Any + Sized) {
self.map.insert(key, RefCell::new(Box::new(a)));
pub fn insert_at(&mut self, key: u32, a: Box<dyn Any>) {
self.map.insert(key, RefCell::new(a));
}
pub fn push(&mut self, a: impl Any + Sized) -> Result<u32, Error> {
pub fn push(&mut self, a: Box<dyn Any>) -> Result<u32, Error> {
loop {
let key = self.next_key;
// XXX this is not correct. The table may still have empty entries, but our
@@ -29,7 +29,7 @@ impl Table {
if self.map.contains_key(&key) {
continue;
}
self.map.insert(key, RefCell::new(Box::new(a)));
self.map.insert(key, RefCell::new(a));
return Ok(key);
}
}