Skip to content

Commit

Permalink
Added changes of b64697d and dealt with rebasing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TisButMe committed Jan 18, 2014
1 parent e1089fe commit 64ab884
Show file tree
Hide file tree
Showing 32 changed files with 270 additions and 251 deletions.
4 changes: 2 additions & 2 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -720,7 +720,7 @@ fn compose_and_run_compiler(

fn ensure_dir(path: &Path) {
if path.is_dir() { return; }
fs::mkdir(path, io::UserRWX);
fs::mkdir(path, io::USER_RWX);
}

fn compose_and_run(config: &config, testfile: &Path,
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/tempfile.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -38,7 +38,7 @@ impl TempDir {
let mut r = rand::rng();
for _ in range(0u, 1000) {
let p = tmpdir.join(r.gen_ascii_str(16) + suffix);
match io::result(|| fs::mkdir(&p, io::UserRWX)) {
match io::result(|| fs::mkdir(&p, io::USER_RWX)) {
Err(..) => {}
Ok(()) => return Some(TempDir { path: Some(p) })
}
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl ToStr for ParseError {
}

// Length of each hyphenated group in hex digits
static UuidGroupLens: [uint, ..5] = [8u, 4u, 4u, 4u, 12u];
static UUID_GROUP_LENS: [uint, ..5] = [8u, 4u, 4u, 4u, 12u];

/// UUID support
impl Uuid {
Expand Down Expand Up @@ -395,7 +395,7 @@ impl Uuid {
5 => {
// Ensure each group length matches the expected
for (i, (&gl, &expected)) in
group_lens.iter().zip(UuidGroupLens.iter()).enumerate() {
group_lens.iter().zip(UUID_GROUP_LENS.iter()).enumerate() {
if gl != expected {
return Err(ErrorInvalidGroupLength(i, gl, expected))
}
Expand Down
29 changes: 15 additions & 14 deletions src/libnative/io/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -27,8 +27,8 @@ use io::{IoResult, retry};
#[cfg(windows)] use std::str;

pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
#[cfg(windows)] static eintr: int = 0; // doesn't matter
#[cfg(not(windows))] static eintr: int = libc::EINTR as int;
#[cfg(windows)] static EINTR: int = 0; // doesn't matter
#[cfg(not(windows))] static EINTR: int = libc::EINTR as int;

let origamt = data.len();
let mut data = data.as_ptr();
Expand All @@ -37,9 +37,9 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
let mut ret;
loop {
ret = f(data, amt);
if cfg!(windows) { break } // windows has no eintr
// if we get an eintr, then try again
if ret != -1 || os::errno() as int != eintr { break }
if cfg!(windows) { break } // windows has no EINTR
// if we get an EINTR, then try again
if ret != -1 || os::errno() as int != EINTR { break }
}
if ret == 0 {
break
Expand All @@ -53,6 +53,7 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
return (origamt - amt) as i64;
}

#[allow(non_camel_case_types)]
pub type fd_t = libc::c_int;

pub struct FileDesc {
Expand All @@ -77,12 +78,12 @@ impl FileDesc {
// native::io wanting to use them is forced to have all the
// rtio traits in scope
pub fn inner_read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
#[cfg(windows)] type rlen = libc::c_uint;
#[cfg(not(windows))] type rlen = libc::size_t;
#[cfg(windows)] type RLen = libc::c_uint;
#[cfg(not(windows))] type RLen = libc::size_t;
let ret = retry(|| unsafe {
libc::read(self.fd,
buf.as_ptr() as *mut libc::c_void,
buf.len() as rlen) as libc::c_int
buf.len() as RLen) as libc::c_int
});
if ret == 0 {
Err(io::standard_error(io::EndOfFile))
Expand All @@ -93,11 +94,11 @@ impl FileDesc {
}
}
pub fn inner_write(&mut self, buf: &[u8]) -> Result<(), IoError> {
#[cfg(windows)] type wlen = libc::c_uint;
#[cfg(not(windows))] type wlen = libc::size_t;
#[cfg(windows)] type WLen = libc::c_uint;
#[cfg(not(windows))] type WLen = libc::size_t;
let ret = keep_going(buf, |buf, len| {
unsafe {
libc::write(self.fd, buf as *libc::c_void, len as wlen) as i64
libc::write(self.fd, buf as *libc::c_void, len as WLen) as i64
}
});
if ret < 0 {
Expand Down Expand Up @@ -782,7 +783,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
path: Path::new(path),
size: stat.st_size as u64,
kind: kind,
perm: (stat.st_mode) as io::FilePermission & io::AllPermissions,
perm: (stat.st_mode) as io::FilePermission & io::ALL_PERMISSIONS,
created: stat.st_ctime as u64,
modified: stat.st_mtime as u64,
accessed: stat.st_atime as u64,
Expand Down Expand Up @@ -831,7 +832,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
path: Path::new(path),
size: stat.st_size as u64,
kind: kind,
perm: (stat.st_mode) as io::FilePermission & io::AllPermissions,
perm: (stat.st_mode) as io::FilePermission & io::ALL_PERMISSIONS,
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),
Expand Down
16 changes: 11 additions & 5 deletions src/libnative/io/net.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -23,7 +23,10 @@ use super::file::keep_going;
// sockaddr and misc bindings
////////////////////////////////////////////////////////////////////////////////

#[allow(non_camel_case_types)]
#[cfg(windows)] pub type sock_t = libc::SOCKET;

#[allow(non_camel_case_types)]
#[cfg(unix)] pub type sock_t = super::file::fd_t;

pub fn htons(u: u16) -> u16 {
Expand Down Expand Up @@ -270,16 +273,16 @@ impl TcpStream {
}
}

#[cfg(windows)] type wrlen = libc::c_int;
#[cfg(not(windows))] type wrlen = libc::size_t;
#[cfg(windows)] type WrLen = libc::c_int;
#[cfg(not(windows))] type WrLen = libc::size_t;

impl rtio::RtioTcpStream for TcpStream {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
let ret = retry(|| {
unsafe {
libc::recv(self.fd,
buf.as_ptr() as *mut libc::c_void,
buf.len() as wrlen,
buf.len() as WrLen,
0) as libc::c_int
}
});
Expand All @@ -296,7 +299,7 @@ impl rtio::RtioTcpStream for TcpStream {
unsafe {
libc::send(self.fd,
buf as *mut libc::c_void,
len as wrlen,
len as WrLen,
0) as i64
}
});
Expand Down Expand Up @@ -487,7 +490,10 @@ impl rtio::RtioSocket for UdpSocket {
}
}

#[allow(non_camel_case_types)]
#[cfg(windows)] type msglen_t = libc::c_int;

#[allow(non_camel_case_types)]
#[cfg(unix)] type msglen_t = libc::size_t;

impl rtio::RtioUdpSocket for UdpSocket {
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/io/process.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -790,7 +790,7 @@ fn is_writeable(p: &Path) -> bool {

match io::result(|| p.stat()) {
Err(..) => true,
Ok(m) => m.perm & io::UserWrite == io::UserWrite
Ok(m) => m.perm & io::USER_WRITE == io::USER_WRITE
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -355,7 +355,7 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
fn pretty_print_to(@self, wr: ~io::Writer, blk: &ast::Block) {
let mut ps = pprust::rust_printer_annotated(wr, self.tcx.sess.intr(),
self as @pprust::PpAnn);
pprust::cbox(&mut ps, pprust::indent_unit);
pprust::cbox(&mut ps, pprust::INDENT_UNIT);
pprust::ibox(&mut ps, 0u);
pprust::print_block(&mut ps, blk);
pp::eof(&mut ps.s);
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -319,7 +319,7 @@ fn mkdir(path: &Path) {
fail!()
}).inside(|| {
if !path.is_dir() {
fs::mkdir(path, io::UserRWX);
fs::mkdir(path, io::USER_RWX);
}
})
}
Expand Down
14 changes: 7 additions & 7 deletions src/librustpkg/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -694,7 +694,7 @@ impl CtxMethods for BuildContext {

for exec in subex.iter() {
debug!("Copying: {} -> {}", exec.display(), sub_target_ex.display());
fs::mkdir_recursive(&sub_target_ex.dir_path(), io::UserRWX);
fs::mkdir_recursive(&sub_target_ex.dir_path(), io::USER_RWX);
fs::copy(exec, &sub_target_ex);
// FIXME (#9639): This needs to handle non-utf8 paths
exe_thing.discover_output("binary",
Expand All @@ -707,7 +707,7 @@ impl CtxMethods for BuildContext {
.clone().expect(format!("I built {} but apparently \
didn't install it!", lib.display()));
target_lib.set_filename(lib.filename().expect("weird target lib"));
fs::mkdir_recursive(&target_lib.dir_path(), io::UserRWX);
fs::mkdir_recursive(&target_lib.dir_path(), io::USER_RWX);
fs::copy(lib, &target_lib);
debug!("3. discovering output {}", target_lib.display());
exe_thing.discover_output("binary",
Expand Down Expand Up @@ -748,10 +748,10 @@ impl CtxMethods for BuildContext {
}

fn init(&self) {
fs::mkdir_recursive(&Path::new("src"), io::UserRWX);
fs::mkdir_recursive(&Path::new("bin"), io::UserRWX);
fs::mkdir_recursive(&Path::new("lib"), io::UserRWX);
fs::mkdir_recursive(&Path::new("build"), io::UserRWX);
fs::mkdir_recursive(&Path::new("src"), io::USER_RWX);
fs::mkdir_recursive(&Path::new("bin"), io::USER_RWX);
fs::mkdir_recursive(&Path::new("lib"), io::USER_RWX);
fs::mkdir_recursive(&Path::new("build"), io::USER_RWX);
}

fn uninstall(&self, _id: &str, _vers: Option<~str>) {
Expand Down
12 changes: 6 additions & 6 deletions src/librustpkg/path_util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -34,7 +34,7 @@ pub fn default_workspace() -> Path {
}
let result = p[0];
if !result.is_dir() {
fs::mkdir_recursive(&result, io::UserRWX);
fs::mkdir_recursive(&result, io::USER_RWX);
}
result
}
Expand All @@ -49,11 +49,11 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
/// and executable by the user. Returns true iff creation
/// succeeded.
pub fn make_dir_rwx(p: &Path) -> bool {
io::result(|| fs::mkdir(p, io::UserRWX)).is_ok()
io::result(|| fs::mkdir(p, io::USER_RWX)).is_ok()
}

pub fn make_dir_rwx_recursive(p: &Path) -> bool {
io::result(|| fs::mkdir_recursive(p, io::UserRWX)).is_ok()
io::result(|| fs::mkdir_recursive(p, io::USER_RWX)).is_ok()
}

// n.b. The next three functions ignore the package version right
Expand Down Expand Up @@ -363,7 +363,7 @@ fn target_file_in_workspace(crateid: &CrateId, workspace: &Path,
(Install, Lib) => target_lib_dir(workspace),
(Install, _) => target_bin_dir(workspace)
};
if io::result(|| fs::mkdir_recursive(&result, io::UserRWX)).is_err() {
if io::result(|| fs::mkdir_recursive(&result, io::USER_RWX)).is_err() {
cond.raise((result.clone(), format!("target_file_in_workspace couldn't \
create the {} dir (crateid={}, workspace={}, what={:?}, where={:?}",
subdir, crateid.to_str(), workspace.display(), what, where)));
Expand All @@ -378,7 +378,7 @@ pub fn build_pkg_id_in_workspace(crateid: &CrateId, workspace: &Path) -> Path {
result.push(&crateid.path);
debug!("Creating build dir {} for package id {}", result.display(),
crateid.to_str());
fs::mkdir_recursive(&result, io::UserRWX);
fs::mkdir_recursive(&result, io::USER_RWX);
return result;
}

Expand Down
Loading

4 comments on commit 64ab884

@bors
Copy link
Contributor

@bors bors commented on 64ab884 Jan 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 64ab884 Jan 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging TisButMe/rust/disallow_stylistic_lint = 64ab884 into auto

@bors
Copy link
Contributor

@bors bors commented on 64ab884 Jan 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TisButMe/rust/disallow_stylistic_lint = 64ab884 merged ok, testing candidate = 81d2ea34

@bors
Copy link
Contributor

@bors bors commented on 64ab884 Jan 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.