Correct style of comments
This commit is contained in:
parent
1c64f29811
commit
67ea454647
3 changed files with 10 additions and 8 deletions
|
|
@ -291,6 +291,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper function to get a `libc` constant as a `Scalar`.
|
||||
fn eval_libc(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
|
||||
self.eval_context_mut()
|
||||
|
|
@ -298,6 +299,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||
.ok_or_else(|| err_unsup_format!("Path libc::{} cannot be resolved.", name).into())
|
||||
.and_then(|scalar| scalar.not_undef())
|
||||
}
|
||||
|
||||
/// Helper function to get a `libc` constant as an `i32`.
|
||||
fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
|
||||
self.eval_libc(name).and_then(|scalar| scalar.to_i32())
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||
Ok(cwd) => {
|
||||
// It is not clear what happens with non-utf8 paths here
|
||||
let mut bytes = cwd.display().to_string().into_bytes();
|
||||
// If `size` is smaller or equal than the `bytes.len()`, writing `bytes` using the
|
||||
// `buf` pointer would cause an overflow, the desired behavior in this case is to
|
||||
// return null.
|
||||
// If `size` is smaller or equal than the `bytes.len()`, writing `bytes` plus the
|
||||
// required null terminator to memory using the `buf` pointer would cause an
|
||||
// overflow, the desired behavior in this case is to return null.
|
||||
if (bytes.len() as u64) < size {
|
||||
// We add a `/0` terminator
|
||||
bytes.push(0);
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use std::env;
|
|||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
// test that `getcwd` is available
|
||||
// Test that `getcwd` is available
|
||||
let cwd = env::current_dir().unwrap();
|
||||
// test that changing dir to `..` actually sets the current directory to the parent of `cwd`.
|
||||
// the only exception here is if `cwd` is the root directory, then changing directory must
|
||||
// Test that changing dir to `..` actually sets the current directory to the parent of `cwd`.
|
||||
// The only exception here is if `cwd` is the root directory, then changing directory must
|
||||
// keep the current directory equal to `cwd`.
|
||||
let parent = cwd.parent().unwrap_or(&cwd);
|
||||
// test that `chdir` is available
|
||||
// Test that `chdir` is available
|
||||
assert!(env::set_current_dir(&Path::new("..")).is_ok());
|
||||
// test that `..` goes to the parent directory
|
||||
// Test that `..` goes to the parent directory
|
||||
assert_eq!(env::current_dir().unwrap(), parent);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue