mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
Correct style of comments
This commit is contained in:
@@ -291,6 +291,7 @@ fn visit_primitive(&mut self, _v: MPlaceTy<'tcx, Tag>) -> InterpResult<'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 @@ fn eval_libc(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
|
||||
.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())
|
||||
|
||||
+3
-3
@@ -133,9 +133,9 @@ fn getcwd(
|
||||
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::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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user