remove unnecessary cast
This commit is contained in:
parent
d7e2650db2
commit
f16b491015
@ -341,7 +341,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
// Turn the wide MPlace into a string (must already be dereferenced!)
|
||||
pub fn read_str(&self, mplace: MPlaceTy<'tcx, M::PointerTag>) -> InterpResult<'tcx, &str> {
|
||||
let len = mplace.len(self)?;
|
||||
let bytes = self.memory.read_bytes(mplace.ptr, Size::from_bytes(u64::from(len)))?;
|
||||
let bytes = self.memory.read_bytes(mplace.ptr, Size::from_bytes(len))?;
|
||||
let str = ::std::str::from_utf8(bytes)
|
||||
.map_err(|err| err_ub_format!("this string is not valid UTF-8: {}", err))?;
|
||||
Ok(str)
|
||||
|
Loading…
x
Reference in New Issue
Block a user