Check safety of as_raw with a simplified borrow checker (#37)
* wiggle-runtime: add as_raw method for [T] * add trivial borrow checker back in * integrate runtime borrow checker with as_raw methods * handle pointer arith overflow correctly in as_raw, create PtrOverflow error * runtime: add validation back to GuestType * generate: impl validate for enums, flags, handles, ints * oops! make validate its own method on trait GuestTypeTransparent * fix transparent impls for enum, flag, handle, int * some structs are transparent. fix tests. * tests: define byte_slice_strat and friends * wiggle-tests: i believe my allocator is working now * some type juggling around memset for ease of use * make GuestTypeTransparent an unsafe trait * delete redundant validation of pointer align * fix doc * wiggle_test: aha, you cant use sets to track memory areas * add multi-string test which exercises the runtime borrow checker against HostMemory::byte_slice_strat * oops left debug panic in * remove redundant (& incorrect, since unchecked) length calc * redesign validate again, and actually hook to as_raw * makr all validate impls as inline this should hopefully allow as_raw's check loop to be unrolled to a no-op in most cases! * code review fixes
This commit is contained in:
@@ -67,9 +67,9 @@ impl ReduceExcusesExcercise {
|
||||
},
|
||||
)
|
||||
.prop_filter("non-overlapping pointers", |e| {
|
||||
let mut all = vec![&e.array_ptr_loc, &e.return_ptr_loc];
|
||||
let mut all = vec![e.array_ptr_loc, e.return_ptr_loc];
|
||||
all.extend(e.excuse_ptr_locs.iter());
|
||||
MemArea::non_overlapping_set(&all)
|
||||
MemArea::non_overlapping_set(all)
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
@@ -155,9 +155,9 @@ impl PopulateExcusesExcercise {
|
||||
elements,
|
||||
})
|
||||
.prop_filter("non-overlapping pointers", |e| {
|
||||
let mut all = vec![&e.array_ptr_loc];
|
||||
let mut all = vec![e.array_ptr_loc];
|
||||
all.extend(e.elements.iter());
|
||||
MemArea::non_overlapping_set(&all)
|
||||
MemArea::non_overlapping_set(all)
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user