diff --git a/src/eval.rs b/src/eval.rs index 6f7f0ba329..897d395674 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -84,7 +84,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( let size = arg.len() as u64 + 1; let arg_type = tcx.mk_array(tcx.types.u8, size); let arg_place = ecx.allocate(ecx.layout_of(arg_type)?, MiriMemoryKind::Env.into()); - ecx.write_os_str_to_c_string(OsStr::new(arg), arg_place.ptr, size)?; + ecx.write_os_str_to_c_str(OsStr::new(arg), arg_place.ptr, size)?; argvs.push(arg_place.ptr); } // Make an array with all these pointers, in the Miri memory. diff --git a/src/helpers.rs b/src/helpers.rs index 9f75c9b7fb..05a92164f2 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -453,7 +453,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx /// Helper function to read an OsString from a null-terminated sequence of bytes, which is what /// the Unix APIs usually handle. - fn read_os_string_from_c_string<'a>(&'a self, scalar: Scalar) -> InterpResult<'tcx, &'a OsStr> + fn read_os_str_from_c_str<'a>(&'a self, scalar: Scalar) -> InterpResult<'tcx, &'a OsStr> where 'tcx: 'a, 'mir: 'a { let this = self.eval_context_ref(); @@ -465,7 +465,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx /// the Unix APIs usually handle. This function returns `Ok(false)` without trying to write if /// `size` is not large enough to fit the contents of `os_string` plus a null terminator. It /// returns `Ok(true)` if the writing process was successful. - fn write_os_str_to_c_string( + fn write_os_str_to_c_str( &mut self, os_str: &OsStr, scalar: Scalar, diff --git a/src/shims/env.rs b/src/shims/env.rs index ae8dae0313..8c431fd201 100644 --- a/src/shims/env.rs +++ b/src/shims/env.rs @@ -128,7 +128,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // If we cannot get the current directory, we return null match env::current_dir() { Ok(cwd) => { - if this.write_os_str_to_c_string(&OsString::from(cwd), buf, size)? { + if this.write_os_str_to_c_str(&OsString::from(cwd), buf, size)? { return Ok(buf); } let erange = this.eval_libc("ERANGE")?; @@ -144,7 +144,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.check_no_isolation("chdir")?; - let path = this.read_os_string_from_c_string(this.read_scalar(path_op)?.not_undef()?)?; + let path = this.read_os_str_from_c_str(this.read_scalar(path_op)?.not_undef()?)?; match env::set_current_dir(path) { Ok(()) => Ok(0), diff --git a/src/shims/fs.rs b/src/shims/fs.rs index 9291f3a6e3..4d10be6264 100644 --- a/src/shims/fs.rs +++ b/src/shims/fs.rs @@ -96,7 +96,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx throw_unsup_format!("unsupported flags {:#x}", flag & !mirror); } - let path = this.read_os_string_from_c_string(this.read_scalar(path_op)?.not_undef()?)?; + let path = this.read_os_str_from_c_str(this.read_scalar(path_op)?.not_undef()?)?; let fd = options.open(path).map(|file| { let mut fh = &mut this.machine.file_handler; @@ -250,7 +250,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.check_no_isolation("unlink")?; - let path = this.read_os_string_from_c_string(this.read_scalar(path_op)?.not_undef()?)?; + let path = this.read_os_str_from_c_str(this.read_scalar(path_op)?.not_undef()?)?; let result = remove_file(path).map(|_| 0);