Skip to content

Commit d620794

Browse files
committed
---
yaml --- r: 130844 b: refs/heads/auto c: 61414a9 h: refs/heads/master v: v3
1 parent 42e8ac5 commit d620794

File tree

16 files changed

+92
-83
lines changed

16 files changed

+92
-83
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: d7502ac2d6c64958be672991c33a1404ea5f040e
16+
refs/heads/auto: 61414a985004a8948be8d01de11f4e55ef0dbad4
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcore/num/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ pub trait Int: Primitive
406406
///
407407
/// assert_eq!(n.count_ones(), 3);
408408
/// ```
409-
fn count_ones(self) -> uint;
409+
fn count_ones(self) -> Self;
410410

411411
/// Returns the number of zeros in the binary representation of the integer.
412412
///
@@ -418,7 +418,7 @@ pub trait Int: Primitive
418418
/// assert_eq!(n.count_zeros(), 5);
419419
/// ```
420420
#[inline]
421-
fn count_zeros(self) -> uint {
421+
fn count_zeros(self) -> Self {
422422
(!self).count_ones()
423423
}
424424

@@ -432,7 +432,7 @@ pub trait Int: Primitive
432432
///
433433
/// assert_eq!(n.leading_zeros(), 10);
434434
/// ```
435-
fn leading_zeros(self) -> uint;
435+
fn leading_zeros(self) -> Self;
436436

437437
/// Returns the number of trailing zeros in the binary representation
438438
/// of the integer.
@@ -444,7 +444,7 @@ pub trait Int: Primitive
444444
///
445445
/// assert_eq!(n.trailing_zeros(), 3);
446446
/// ```
447-
fn trailing_zeros(self) -> uint;
447+
fn trailing_zeros(self) -> Self;
448448

449449
/// Shifts the bits to the left by a specified amount amount, `n`, wrapping
450450
/// the truncated bits to the end of the resulting integer.
@@ -569,13 +569,13 @@ macro_rules! int_impl {
569569
($T:ty, $BITS:expr, $ctpop:path, $ctlz:path, $cttz:path, $bswap:path) => {
570570
impl Int for $T {
571571
#[inline]
572-
fn count_ones(self) -> uint { unsafe { $ctpop(self) as uint } }
572+
fn count_ones(self) -> $T { unsafe { $ctpop(self) } }
573573

574574
#[inline]
575-
fn leading_zeros(self) -> uint { unsafe { $ctlz(self) as uint } }
575+
fn leading_zeros(self) -> $T { unsafe { $ctlz(self) } }
576576

577577
#[inline]
578-
fn trailing_zeros(self) -> uint { unsafe { $cttz(self) as uint } }
578+
fn trailing_zeros(self) -> $T { unsafe { $cttz(self) } }
579579

580580
#[inline]
581581
fn rotate_left(self, n: uint) -> $T {
@@ -629,13 +629,13 @@ macro_rules! int_cast_impl {
629629
($T:ty, $U:ty) => {
630630
impl Int for $T {
631631
#[inline]
632-
fn count_ones(self) -> uint { (self as $U).count_ones() }
632+
fn count_ones(self) -> $T { (self as $U).count_ones() as $T }
633633

634634
#[inline]
635-
fn leading_zeros(self) -> uint { (self as $U).leading_zeros() }
635+
fn leading_zeros(self) -> $T { (self as $U).leading_zeros() as $T }
636636

637637
#[inline]
638-
fn trailing_zeros(self) -> uint { (self as $U).trailing_zeros() }
638+
fn trailing_zeros(self) -> $T { (self as $U).trailing_zeros() as $T }
639639

640640
#[inline]
641641
fn rotate_left(self, n: uint) -> $T { (self as $U).rotate_left(n) as $T }

branches/auto/src/libcoretest/num/int_macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ mod tests {
9595

9696
#[test]
9797
fn test_count_zeros() {
98-
assert!(A.count_zeros() == BITS - 3);
99-
assert!(B.count_zeros() == BITS - 2);
100-
assert!(C.count_zeros() == BITS - 5);
98+
assert!(A.count_zeros() == BITS as $T - 3);
99+
assert!(B.count_zeros() == BITS as $T - 2);
100+
assert!(C.count_zeros() == BITS as $T - 5);
101101
}
102102

103103
#[test]

branches/auto/src/libcoretest/num/uint_macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ mod tests {
5555

5656
#[test]
5757
fn test_count_zeros() {
58-
assert!(A.count_zeros() == BITS - 3);
59-
assert!(B.count_zeros() == BITS - 2);
60-
assert!(C.count_zeros() == BITS - 5);
58+
assert!(A.count_zeros() == BITS as $T - 3);
59+
assert!(B.count_zeros() == BITS as $T - 2);
60+
assert!(C.count_zeros() == BITS as $T - 5);
6161
}
6262

6363
#[test]

branches/auto/src/liblibc/lib.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ pub use funcs::bsd43::{shutdown};
249249
#[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG};
250250
#[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR};
251251
#[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD};
252-
#[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES, WIN32_FIND_DATAW};
252+
#[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES};
253253
#[cfg(windows)] pub use funcs::c95::string::{wcslen};
254254
#[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir};
255255
#[cfg(windows)] pub use funcs::bsd43::{closesocket};
@@ -1638,22 +1638,6 @@ pub mod types {
16381638
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
16391639

16401640
pub type GROUP = c_uint;
1641-
1642-
#[repr(C)]
1643-
pub struct WIN32_FIND_DATAW {
1644-
pub dwFileAttributes: DWORD,
1645-
pub ftCreationTime: FILETIME,
1646-
pub ftLastAccessTime: FILETIME,
1647-
pub ftLastWriteTime: FILETIME,
1648-
pub nFileSizeHigh: DWORD,
1649-
pub nFileSizeLow: DWORD,
1650-
pub dwReserved0: DWORD,
1651-
pub dwReserved1: DWORD,
1652-
pub cFileName: [wchar_t, ..260], // #define MAX_PATH 260
1653-
pub cAlternateFileName: [wchar_t, ..14],
1654-
}
1655-
1656-
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
16571641
}
16581642
}
16591643
}
@@ -4779,7 +4763,7 @@ pub mod funcs {
47794763
LPMEMORY_BASIC_INFORMATION,
47804764
LPSYSTEM_INFO, HANDLE, LPHANDLE,
47814765
LARGE_INTEGER, PLARGE_INTEGER,
4782-
LPFILETIME, LPWIN32_FIND_DATAW};
4766+
LPFILETIME};
47834767

47844768
extern "system" {
47854769
pub fn GetEnvironmentVariableW(n: LPCWSTR,
@@ -4809,9 +4793,9 @@ pub mod funcs {
48094793
-> DWORD;
48104794
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
48114795
pub fn GetLastError() -> DWORD;
4812-
pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
4796+
pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: HANDLE)
48134797
-> HANDLE;
4814-
pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
4798+
pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
48154799
-> BOOL;
48164800
pub fn FindClose(findFile: HANDLE) -> BOOL;
48174801
pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,

branches/auto/src/libnative/io/file_windows.rs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
//! Blocking Windows-based file I/O
1212
1313
use alloc::arc::Arc;
14-
use libc::{mod, c_int};
14+
use libc::{c_int, c_void};
15+
use libc;
1516
use std::c_str::CString;
1617
use std::mem;
1718
use std::os::windows::fill_utf16_buf_and_decode;
1819
use std::ptr;
1920
use std::rt::rtio;
2021
use std::rt::rtio::{IoResult, IoError};
2122
use std::str;
23+
use std::vec;
2224

2325
pub type fd_t = libc::c_int;
2426

@@ -342,6 +344,8 @@ pub fn mkdir(p: &CString, _mode: uint) -> IoResult<()> {
342344
}
343345

344346
pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
347+
use std::rt::libc_heap::malloc_raw;
348+
345349
fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
346350
let root = unsafe { CString::new(root.as_ptr(), false) };
347351
let root = Path::new(root);
@@ -351,35 +355,38 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
351355
}).map(|path| root.join(path).to_c_str()).collect()
352356
}
353357

358+
extern {
359+
fn rust_list_dir_wfd_size() -> libc::size_t;
360+
fn rust_list_dir_wfd_fp_buf(wfd: *mut libc::c_void) -> *const u16;
361+
}
354362
let star = Path::new(unsafe {
355363
CString::new(p.as_ptr(), false)
356364
}).join("*");
357365
let path = try!(to_utf16(&star.to_c_str()));
358366

359367
unsafe {
360-
let mut wfd = mem::zeroed();
361-
let find_handle = libc::FindFirstFileW(path.as_ptr(), &mut wfd);
368+
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
369+
let find_handle = libc::FindFirstFileW(path.as_ptr(),
370+
wfd_ptr as libc::HANDLE);
362371
if find_handle != libc::INVALID_HANDLE_VALUE {
363-
let mut paths = vec![];
364-
let mut more_files = 1 as libc::BOOL;
372+
let mut paths = vec!();
373+
let mut more_files = 1 as libc::c_int;
365374
while more_files != 0 {
366-
{
367-
let filename = str::truncate_utf16_at_nul(wfd.cFileName);
368-
match String::from_utf16(filename) {
369-
Some(filename) => paths.push(Path::new(filename)),
370-
None => {
371-
assert!(libc::FindClose(find_handle) != 0);
372-
return Err(IoError {
373-
code: super::c::ERROR_ILLEGAL_CHARACTER as uint,
374-
extra: 0,
375-
detail: Some(format!("path was not valid UTF-16: {}", filename)),
376-
})
377-
}, // FIXME #12056: Convert the UCS-2 to invalid utf-8 instead of erroring
378-
}
375+
let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *mut c_void);
376+
if fp_buf as uint == 0 {
377+
fail!("os::list_dir() failure: got null ptr from wfd");
378+
} else {
379+
let fp_vec = vec::raw::from_buf(fp_buf, libc::wcslen(fp_buf) as uint);
380+
let fp_trimmed = str::truncate_utf16_at_nul(fp_vec.as_slice());
381+
let fp_str = String::from_utf16(fp_trimmed)
382+
.expect("rust_list_dir_wfd_fp_buf returned invalid UTF-16");
383+
paths.push(Path::new(fp_str));
379384
}
380-
more_files = libc::FindNextFileW(find_handle, &mut wfd);
385+
more_files = libc::FindNextFileW(find_handle,
386+
wfd_ptr as libc::HANDLE);
381387
}
382388
assert!(libc::FindClose(find_handle) != 0);
389+
libc::free(wfd_ptr as *mut c_void);
383390
Ok(prune(p, paths))
384391
} else {
385392
Err(super::last_error())

branches/auto/src/libnum/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl BigUint {
807807
pub fn bits(&self) -> uint {
808808
if self.is_zero() { return 0; }
809809
let zeros = self.data.last().unwrap().leading_zeros();
810-
return self.data.len()*BigDigit::bits - zeros;
810+
return self.data.len()*BigDigit::bits - (zeros as uint);
811811
}
812812
}
813813

branches/auto/src/librustc/back/link.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use util::ppaux;
2828
use util::sha2::{Digest, Sha256};
2929

3030
use std::char;
31-
use std::collections::HashSet;
3231
use std::io::{fs, TempDir, Command};
3332
use std::io;
3433
use std::mem;
@@ -570,10 +569,7 @@ fn link_binary_output(sess: &Session,
570569
fn archive_search_paths(sess: &Session) -> Vec<Path> {
571570
let mut rustpath = filesearch::rust_path();
572571
rustpath.push(sess.target_filesearch().get_lib_path());
573-
// FIXME: Addl lib search paths are an unordered HashSet?
574-
// Shouldn't this search be done in some order?
575-
let addl_lib_paths: HashSet<Path> = sess.opts.addl_lib_search_paths.borrow().clone();
576-
let mut search: Vec<Path> = addl_lib_paths.move_iter().collect();
572+
let mut search: Vec<Path> = sess.opts.addl_lib_search_paths.borrow().clone();
577573
search.push_all(rustpath.as_slice());
578574
return search;
579575
}

branches/auto/src/librustc/driver/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use syntax::diagnostic::{ColorConfig, Auto, Always, Never};
3030
use syntax::parse;
3131
use syntax::parse::token::InternedString;
3232

33-
use std::collections::{HashSet, HashMap};
33+
use std::collections::HashMap;
3434
use getopts::{optopt, optmulti, optflag, optflagopt};
3535
use getopts;
3636
use std::cell::{RefCell};
@@ -76,7 +76,7 @@ pub struct Options {
7676
// This was mutable for rustpkg, which updates search paths based on the
7777
// parsed code. It remains mutable in case its replacements wants to use
7878
// this.
79-
pub addl_lib_search_paths: RefCell<HashSet<Path>>,
79+
pub addl_lib_search_paths: RefCell<Vec<Path>>,
8080
pub maybe_sysroot: Option<Path>,
8181
pub target_triple: String,
8282
// User-specified cfg meta items. The compiler itself will add additional
@@ -113,7 +113,7 @@ pub fn basic_options() -> Options {
113113
lint_opts: Vec::new(),
114114
describe_lints: false,
115115
output_types: Vec::new(),
116-
addl_lib_search_paths: RefCell::new(HashSet::new()),
116+
addl_lib_search_paths: RefCell::new(Vec::new()),
117117
maybe_sysroot: None,
118118
target_triple: driver::host_triple().to_string(),
119119
cfg: Vec::new(),

branches/auto/src/librustc/metadata/filesearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub type pick<'a> = |path: &Path|: 'a -> FileMatch;
3030

3131
pub struct FileSearch<'a> {
3232
pub sysroot: &'a Path,
33-
pub addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
33+
pub addl_lib_search_paths: &'a RefCell<Vec<Path>>,
3434
pub triple: &'a str,
3535
}
3636

@@ -125,7 +125,7 @@ impl<'a> FileSearch<'a> {
125125

126126
pub fn new(sysroot: &'a Path,
127127
triple: &'a str,
128-
addl_lib_search_paths: &'a RefCell<HashSet<Path>>) -> FileSearch<'a> {
128+
addl_lib_search_paths: &'a RefCell<Vec<Path>>) -> FileSearch<'a> {
129129
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
130130
FileSearch {
131131
sysroot: sysroot,

branches/auto/src/librustdoc/core.rs

Lines changed: 3 additions & 3 deletions
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
//
@@ -80,7 +80,7 @@ pub struct CrateAnalysis {
8080
pub type Externs = HashMap<String, Vec<String>>;
8181

8282
/// Parses, resolves, and typechecks the given crate
83-
fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>,
83+
fn get_ast_and_resolve(cpath: &Path, libs: Vec<Path>, cfgs: Vec<String>,
8484
externs: Externs, triple: Option<String>)
8585
-> (DocContext, CrateAnalysis) {
8686
use syntax::codemap::dummy_spanned;
@@ -153,7 +153,7 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>,
153153
})
154154
}
155155

156-
pub fn run_core(libs: HashSet<Path>, cfgs: Vec<String>, externs: Externs,
156+
pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
157157
path: &Path, triple: Option<String>)
158158
-> (clean::Crate, CrateAnalysis) {
159159
let (ctxt, analysis) = get_ast_and_resolve(path, libs, cfgs, externs, triple);

branches/auto/src/librustdoc/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
369369
info!("starting to run rustc");
370370
let (mut krate, analysis) = std::task::try(proc() {
371371
let cr = cr;
372-
core::run_core(libs.move_iter().collect(),
373-
cfgs,
374-
externs,
375-
&cr,
376-
triple)
372+
core::run_core(libs, cfgs, externs, &cr, triple)
377373
}).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap();
378374
info!("finished with rustc");
379375
analysiskey.replace(Some(analysis));

branches/auto/src/librustdoc/markdown.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::collections::HashSet;
1211
use std::io;
1312
use std::string::String;
1413

@@ -136,7 +135,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
136135
}
137136

138137
/// Run any tests/code examples in the markdown file `input`.
139-
pub fn test(input: &str, libs: HashSet<Path>, externs: core::Externs,
138+
pub fn test(input: &str, libs: Vec<Path>, externs: core::Externs,
140139
mut test_args: Vec<String>) -> int {
141140
let input_str = load_or_return!(input, 1, 2);
142141

0 commit comments

Comments
 (0)