document BorrowChecker, make creation unsafe
This commit is contained in:
@@ -77,7 +77,7 @@ impl ReduceExcusesExcercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
// Populate memory with pointers to generated Excuse values
|
||||
for (&excuse, ptr) in self.excuse_values.iter().zip(self.excuse_ptr_locs.iter()) {
|
||||
@@ -169,7 +169,7 @@ impl PopulateExcusesExcercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
// Populate array with valid pointers to Excuse type in memory
|
||||
let ptr = host_memory.ptr::<[GuestPtr<'_, types::Excuse>]>(
|
||||
|
||||
@@ -31,7 +31,7 @@ impl IntFloatExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let e = atoms::int_float_args(&ctx, &host_memory, &bc, self.an_int as i32, self.an_float);
|
||||
|
||||
@@ -61,7 +61,7 @@ impl DoubleIntExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let e = atoms::double_int_return_float(
|
||||
&ctx,
|
||||
|
||||
@@ -65,7 +65,7 @@ impl ConfigureCarExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
// Populate input ptr
|
||||
host_memory
|
||||
|
||||
@@ -34,7 +34,7 @@ impl HandleExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let e = handle_examples::fd_create(&ctx, &host_memory, &bc, self.return_loc.ptr as i32);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ impl CookieCutterExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let res = ints::cookie_cutter(
|
||||
&ctx,
|
||||
|
||||
@@ -128,7 +128,7 @@ impl PointersAndEnumsExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
host_memory
|
||||
.ptr(&bc, self.input2_loc.ptr)
|
||||
|
||||
@@ -69,7 +69,7 @@ impl HelloStringExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
// Populate string in guest's memory
|
||||
let ptr =
|
||||
@@ -178,7 +178,7 @@ impl MultiStringExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let write_string = |val: &str, loc: MemArea| {
|
||||
let ptr = host_memory.ptr::<str>(&bc, (loc.ptr, val.len() as u32));
|
||||
|
||||
@@ -83,7 +83,7 @@ impl SumOfPairExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
host_memory
|
||||
.ptr(&bc, self.input_loc.ptr)
|
||||
@@ -173,7 +173,7 @@ impl SumPairPtrsExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
host_memory
|
||||
.ptr(&bc, self.input_first_loc.ptr)
|
||||
@@ -259,7 +259,7 @@ impl SumIntAndPtrExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
host_memory
|
||||
.ptr(&bc, self.input_first_loc.ptr)
|
||||
@@ -318,7 +318,7 @@ impl ReturnPairInts {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let err = structs::return_pair_ints(&ctx, &host_memory, &bc, self.return_loc.ptr as i32);
|
||||
|
||||
@@ -384,7 +384,7 @@ impl ReturnPairPtrsExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
host_memory
|
||||
.ptr(&bc, self.input_first_loc.ptr)
|
||||
|
||||
@@ -107,7 +107,7 @@ impl GetTagExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let discriminant: u8 = reason_tag(&self.input).into();
|
||||
host_memory
|
||||
@@ -186,7 +186,7 @@ impl ReasonMultExercise {
|
||||
pub fn test(&self) {
|
||||
let ctx = WasiCtx::new();
|
||||
let host_memory = HostMemory::new();
|
||||
let bc = BorrowChecker::new();
|
||||
let bc = unsafe { BorrowChecker::new() };
|
||||
|
||||
let discriminant: u8 = reason_tag(&self.input).into();
|
||||
host_memory
|
||||
|
||||
Reference in New Issue
Block a user