Skip to content

Commit 64ab884

Browse files
committed
Added changes of b64697d and dealt with rebasing issues
1 parent e1089fe commit 64ab884

File tree

32 files changed

+270
-251
lines changed

32 files changed

+270
-251
lines changed

src/compiletest/runtest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -720,7 +720,7 @@ fn compose_and_run_compiler(
720720

721721
fn ensure_dir(path: &Path) {
722722
if path.is_dir() { return; }
723-
fs::mkdir(path, io::UserRWX);
723+
fs::mkdir(path, io::USER_RWX);
724724
}
725725

726726
fn compose_and_run(config: &config, testfile: &Path,

src/libextra/tempfile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -38,7 +38,7 @@ impl TempDir {
3838
let mut r = rand::rng();
3939
for _ in range(0u, 1000) {
4040
let p = tmpdir.join(r.gen_ascii_str(16) + suffix);
41-
match io::result(|| fs::mkdir(&p, io::UserRWX)) {
41+
match io::result(|| fs::mkdir(&p, io::USER_RWX)) {
4242
Err(..) => {}
4343
Ok(()) => return Some(TempDir { path: Some(p) })
4444
}

src/libextra/uuid.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl ToStr for ParseError {
154154
}
155155

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

159159
/// UUID support
160160
impl Uuid {
@@ -395,7 +395,7 @@ impl Uuid {
395395
5 => {
396396
// Ensure each group length matches the expected
397397
for (i, (&gl, &expected)) in
398-
group_lens.iter().zip(UuidGroupLens.iter()).enumerate() {
398+
group_lens.iter().zip(UUID_GROUP_LENS.iter()).enumerate() {
399399
if gl != expected {
400400
return Err(ErrorInvalidGroupLength(i, gl, expected))
401401
}

src/libnative/io/file.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -27,8 +27,8 @@ use io::{IoResult, retry};
2727
#[cfg(windows)] use std::str;
2828

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

3333
let origamt = data.len();
3434
let mut data = data.as_ptr();
@@ -37,9 +37,9 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
3737
let mut ret;
3838
loop {
3939
ret = f(data, amt);
40-
if cfg!(windows) { break } // windows has no eintr
41-
// if we get an eintr, then try again
42-
if ret != -1 || os::errno() as int != eintr { break }
40+
if cfg!(windows) { break } // windows has no EINTR
41+
// if we get an EINTR, then try again
42+
if ret != -1 || os::errno() as int != EINTR { break }
4343
}
4444
if ret == 0 {
4545
break
@@ -53,6 +53,7 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
5353
return (origamt - amt) as i64;
5454
}
5555

56+
#[allow(non_camel_case_types)]
5657
pub type fd_t = libc::c_int;
5758

5859
pub struct FileDesc {
@@ -77,12 +78,12 @@ impl FileDesc {
7778
// native::io wanting to use them is forced to have all the
7879
// rtio traits in scope
7980
pub fn inner_read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
80-
#[cfg(windows)] type rlen = libc::c_uint;
81-
#[cfg(not(windows))] type rlen = libc::size_t;
81+
#[cfg(windows)] type RLen = libc::c_uint;
82+
#[cfg(not(windows))] type RLen = libc::size_t;
8283
let ret = retry(|| unsafe {
8384
libc::read(self.fd,
8485
buf.as_ptr() as *mut libc::c_void,
85-
buf.len() as rlen) as libc::c_int
86+
buf.len() as RLen) as libc::c_int
8687
});
8788
if ret == 0 {
8889
Err(io::standard_error(io::EndOfFile))
@@ -93,11 +94,11 @@ impl FileDesc {
9394
}
9495
}
9596
pub fn inner_write(&mut self, buf: &[u8]) -> Result<(), IoError> {
96-
#[cfg(windows)] type wlen = libc::c_uint;
97-
#[cfg(not(windows))] type wlen = libc::size_t;
97+
#[cfg(windows)] type WLen = libc::c_uint;
98+
#[cfg(not(windows))] type WLen = libc::size_t;
9899
let ret = keep_going(buf, |buf, len| {
99100
unsafe {
100-
libc::write(self.fd, buf as *libc::c_void, len as wlen) as i64
101+
libc::write(self.fd, buf as *libc::c_void, len as WLen) as i64
101102
}
102103
});
103104
if ret < 0 {
@@ -782,7 +783,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
782783
path: Path::new(path),
783784
size: stat.st_size as u64,
784785
kind: kind,
785-
perm: (stat.st_mode) as io::FilePermission & io::AllPermissions,
786+
perm: (stat.st_mode) as io::FilePermission & io::ALL_PERMISSIONS,
786787
created: stat.st_ctime as u64,
787788
modified: stat.st_mtime as u64,
788789
accessed: stat.st_atime as u64,
@@ -831,7 +832,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
831832
path: Path::new(path),
832833
size: stat.st_size as u64,
833834
kind: kind,
834-
perm: (stat.st_mode) as io::FilePermission & io::AllPermissions,
835+
perm: (stat.st_mode) as io::FilePermission & io::ALL_PERMISSIONS,
835836
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
836837
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
837838
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),

src/libnative/io/net.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -23,7 +23,10 @@ use super::file::keep_going;
2323
// sockaddr and misc bindings
2424
////////////////////////////////////////////////////////////////////////////////
2525

26+
#[allow(non_camel_case_types)]
2627
#[cfg(windows)] pub type sock_t = libc::SOCKET;
28+
29+
#[allow(non_camel_case_types)]
2730
#[cfg(unix)] pub type sock_t = super::file::fd_t;
2831

2932
pub fn htons(u: u16) -> u16 {
@@ -270,16 +273,16 @@ impl TcpStream {
270273
}
271274
}
272275

273-
#[cfg(windows)] type wrlen = libc::c_int;
274-
#[cfg(not(windows))] type wrlen = libc::size_t;
276+
#[cfg(windows)] type WrLen = libc::c_int;
277+
#[cfg(not(windows))] type WrLen = libc::size_t;
275278

276279
impl rtio::RtioTcpStream for TcpStream {
277280
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
278281
let ret = retry(|| {
279282
unsafe {
280283
libc::recv(self.fd,
281284
buf.as_ptr() as *mut libc::c_void,
282-
buf.len() as wrlen,
285+
buf.len() as WrLen,
283286
0) as libc::c_int
284287
}
285288
});
@@ -296,7 +299,7 @@ impl rtio::RtioTcpStream for TcpStream {
296299
unsafe {
297300
libc::send(self.fd,
298301
buf as *mut libc::c_void,
299-
len as wrlen,
302+
len as WrLen,
300303
0) as i64
301304
}
302305
});
@@ -487,7 +490,10 @@ impl rtio::RtioSocket for UdpSocket {
487490
}
488491
}
489492

493+
#[allow(non_camel_case_types)]
490494
#[cfg(windows)] type msglen_t = libc::c_int;
495+
496+
#[allow(non_camel_case_types)]
491497
#[cfg(unix)] type msglen_t = libc::size_t;
492498

493499
impl rtio::RtioUdpSocket for UdpSocket {

src/libnative/io/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/librustc/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -790,7 +790,7 @@ fn is_writeable(p: &Path) -> bool {
790790

791791
match io::result(|| p.stat()) {
792792
Err(..) => true,
793-
Ok(m) => m.perm & io::UserWrite == io::UserWrite
793+
Ok(m) => m.perm & io::USER_WRITE == io::USER_WRITE
794794
}
795795
}
796796

src/librustc/middle/dataflow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -355,7 +355,7 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
355355
fn pretty_print_to(@self, wr: ~io::Writer, blk: &ast::Block) {
356356
let mut ps = pprust::rust_printer_annotated(wr, self.tcx.sess.intr(),
357357
self as @pprust::PpAnn);
358-
pprust::cbox(&mut ps, pprust::indent_unit);
358+
pprust::cbox(&mut ps, pprust::INDENT_UNIT);
359359
pprust::ibox(&mut ps, 0u);
360360
pprust::print_block(&mut ps, blk);
361361
pp::eof(&mut ps.s);

src/librustdoc/html/render.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -319,7 +319,7 @@ fn mkdir(path: &Path) {
319319
fail!()
320320
}).inside(|| {
321321
if !path.is_dir() {
322-
fs::mkdir(path, io::UserRWX);
322+
fs::mkdir(path, io::USER_RWX);
323323
}
324324
})
325325
}

src/librustpkg/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -694,7 +694,7 @@ impl CtxMethods for BuildContext {
694694

695695
for exec in subex.iter() {
696696
debug!("Copying: {} -> {}", exec.display(), sub_target_ex.display());
697-
fs::mkdir_recursive(&sub_target_ex.dir_path(), io::UserRWX);
697+
fs::mkdir_recursive(&sub_target_ex.dir_path(), io::USER_RWX);
698698
fs::copy(exec, &sub_target_ex);
699699
// FIXME (#9639): This needs to handle non-utf8 paths
700700
exe_thing.discover_output("binary",
@@ -707,7 +707,7 @@ impl CtxMethods for BuildContext {
707707
.clone().expect(format!("I built {} but apparently \
708708
didn't install it!", lib.display()));
709709
target_lib.set_filename(lib.filename().expect("weird target lib"));
710-
fs::mkdir_recursive(&target_lib.dir_path(), io::UserRWX);
710+
fs::mkdir_recursive(&target_lib.dir_path(), io::USER_RWX);
711711
fs::copy(lib, &target_lib);
712712
debug!("3. discovering output {}", target_lib.display());
713713
exe_thing.discover_output("binary",
@@ -748,10 +748,10 @@ impl CtxMethods for BuildContext {
748748
}
749749

750750
fn init(&self) {
751-
fs::mkdir_recursive(&Path::new("src"), io::UserRWX);
752-
fs::mkdir_recursive(&Path::new("bin"), io::UserRWX);
753-
fs::mkdir_recursive(&Path::new("lib"), io::UserRWX);
754-
fs::mkdir_recursive(&Path::new("build"), io::UserRWX);
751+
fs::mkdir_recursive(&Path::new("src"), io::USER_RWX);
752+
fs::mkdir_recursive(&Path::new("bin"), io::USER_RWX);
753+
fs::mkdir_recursive(&Path::new("lib"), io::USER_RWX);
754+
fs::mkdir_recursive(&Path::new("build"), io::USER_RWX);
755755
}
756756

757757
fn uninstall(&self, _id: &str, _vers: Option<~str>) {

src/librustpkg/path_util.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -34,7 +34,7 @@ pub fn default_workspace() -> Path {
3434
}
3535
let result = p[0];
3636
if !result.is_dir() {
37-
fs::mkdir_recursive(&result, io::UserRWX);
37+
fs::mkdir_recursive(&result, io::USER_RWX);
3838
}
3939
result
4040
}
@@ -49,11 +49,11 @@ pub static U_RWX: i32 = (S_IRUSR | S_IWUSR | S_IXUSR) as i32;
4949
/// and executable by the user. Returns true iff creation
5050
/// succeeded.
5151
pub fn make_dir_rwx(p: &Path) -> bool {
52-
io::result(|| fs::mkdir(p, io::UserRWX)).is_ok()
52+
io::result(|| fs::mkdir(p, io::USER_RWX)).is_ok()
5353
}
5454

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

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

0 commit comments

Comments
 (0)