code review: remove unsafe on borrow checker constructor
This commit is contained in:
@@ -12,7 +12,7 @@ impl BorrowChecker {
|
|||||||
/// `GuestSlice` and `GuestStr` structs, which implement `std::ops::Deref` and
|
/// `GuestSlice` and `GuestStr` structs, which implement `std::ops::Deref` and
|
||||||
/// `std::ops::DerefMut`. It also enforces that `GuestPtr::read` and `GuestPtr::write` do not
|
/// `std::ops::DerefMut`. It also enforces that `GuestPtr::read` and `GuestPtr::write` do not
|
||||||
/// access memory with an outstanding borrow.
|
/// access memory with an outstanding borrow.
|
||||||
pub unsafe fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
BorrowChecker {
|
BorrowChecker {
|
||||||
bc: RefCell::new(InnerBorrowChecker::new()),
|
bc: RefCell::new(InnerBorrowChecker::new()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ impl HostMemory {
|
|||||||
buffer: HostBuffer {
|
buffer: HostBuffer {
|
||||||
cell: UnsafeCell::new([0; 4096]),
|
cell: UnsafeCell::new([0; 4096]),
|
||||||
},
|
},
|
||||||
bc: unsafe { BorrowChecker::new() },
|
bc: BorrowChecker::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ impl BorrowChecker {
|
|||||||
/// `GuestSlice` and `GuestStr` structs, which implement `std::ops::Deref` and
|
/// `GuestSlice` and `GuestStr` structs, which implement `std::ops::Deref` and
|
||||||
/// `std::ops::DerefMut`. It also enforces that `GuestPtr::read` and `GuestPtr::write` do not
|
/// `std::ops::DerefMut`. It also enforces that `GuestPtr::read` and `GuestPtr::write` do not
|
||||||
/// access memory with an outstanding borrow.
|
/// access memory with an outstanding borrow.
|
||||||
pub unsafe fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
BorrowChecker {
|
BorrowChecker {
|
||||||
bc: RefCell::new(InnerBorrowChecker::new()),
|
bc: RefCell::new(InnerBorrowChecker::new()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ impl WasmtimeGuestMemory {
|
|||||||
// This BorrowChecker construction is a holdover until it is
|
// This BorrowChecker construction is a holdover until it is
|
||||||
// integrated fully with wasmtime:
|
// integrated fully with wasmtime:
|
||||||
// https://github.com/bytecodealliance/wasmtime/issues/1917
|
// https://github.com/bytecodealliance/wasmtime/issues/1917
|
||||||
bc: unsafe { BorrowChecker::new() },
|
bc: BorrowChecker::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user