Skip to content

Commit e1537b5

Browse files
committed
---
yaml --- r: 146060 b: refs/heads/try2 c: 93b95dd h: refs/heads/master v: v3
1 parent 61f994f commit e1537b5

File tree

8 files changed

+15
-176
lines changed

8 files changed

+15
-176
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 69860b79b8f4882426fb5755c6d00e6717adeb38
8+
refs/heads/try2: 93b95dd394c9c98c9a00bfcbdc0d6c9c8c59762e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ pub mod write {
297297
if !sess.no_prepopulate_passes() {
298298
llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
299299
llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
300-
populate_llvm_passess(fpm, mpm, llmod, OptLevel);
300+
populate_llvm_passes(fpm, mpm, llmod, OptLevel);
301301
}
302302

303303
for pass in sess.opts.custom_passes.iter() {
@@ -422,10 +422,10 @@ pub mod write {
422422
}
423423
}
424424

425-
unsafe fn populate_llvm_passess(fpm: lib::llvm::PassManagerRef,
426-
mpm: lib::llvm::PassManagerRef,
427-
llmod: ModuleRef,
428-
opt: lib::llvm::CodeGenOptLevel) {
425+
unsafe fn populate_llvm_passes(fpm: lib::llvm::PassManagerRef,
426+
mpm: lib::llvm::PassManagerRef,
427+
llmod: ModuleRef,
428+
opt: lib::llvm::CodeGenOptLevel) {
429429
// Create the PassManagerBuilder for LLVM. We configure it with
430430
// reasonable defaults and prepare it to actually populate the pass
431431
// manager.

branches/try2/src/libstd/libc.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ pub mod consts {
12081208
pub static ERROR_ALREADY_EXISTS : c_int = 183;
12091209
pub static ERROR_INVALID_ADDRESS : c_int = 487;
12101210
pub static ERROR_FILE_INVALID : c_int = 1006;
1211-
pub static INVALID_HANDLE_VALUE : c_int = -1;
1211+
pub static INVALID_HANDLE_VALUE: c_int = -1;
12121212

12131213
pub static DELETE : DWORD = 0x00010000;
12141214
pub static READ_CONTROL : DWORD = 0x00020000;
@@ -3352,14 +3352,11 @@ pub mod funcs {
33523352
LPSECURITY_ATTRIBUTES)
33533353
-> BOOL;
33543354
pub fn CopyFileW(lpExistingFileName: LPCWSTR,
3355-
lpNewFileName: LPCWSTR,
3356-
bFailIfExists: BOOL)
3357-
-> BOOL;
3355+
lpNewFileName: LPCWSTR,
3356+
bFailIfExists: BOOL)
3357+
-> BOOL;
33583358
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
33593359
pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3360-
pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
3361-
lpBuffer: LPWSTR)
3362-
-> DWORD;
33633360
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
33643361
pub fn GetLastError() -> DWORD;
33653362
pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
@@ -3465,9 +3462,6 @@ pub mod funcs {
34653462
-> BOOL;
34663463
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
34673464
pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3468-
pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
3469-
lpBuffer: LPWSTR)
3470-
-> DWORD;
34713465
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
34723466
pub fn GetLastError() -> DWORD;
34733467
pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)

branches/try2/src/libstd/os.rs

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828

2929
#[allow(missing_doc)];
3030

31-
#[cfg(unix)]
32-
use c_str::CString;
31+
use c_str::{CString, ToCStr};
3332
use clone::Clone;
3433
use container::Container;
3534
use io;
@@ -57,11 +56,6 @@ pub fn close(fd: c_int) -> c_int {
5756
}
5857
}
5958

60-
// On Windows, wide character version of function must be used to support
61-
// unicode, so functions should be split into at least two versions,
62-
// which are for Windows and for non-Windows, if necessary.
63-
// See https://github.com/mozilla/rust/issues/9822 for more information.
64-
6559
pub mod rustrt {
6660
use libc::{c_char, c_int};
6761
use libc;
@@ -70,19 +64,11 @@ pub mod rustrt {
7064
pub fn rust_path_is_dir(path: *libc::c_char) -> c_int;
7165
pub fn rust_path_exists(path: *libc::c_char) -> c_int;
7266
}
73-
74-
// Uses _wstat instead of stat.
75-
#[cfg(windows)]
76-
extern {
77-
pub fn rust_path_is_dir_u16(path: *u16) -> c_int;
78-
pub fn rust_path_exists_u16(path: *u16) -> c_int;
79-
}
8067
}
8168

8269
pub static TMPBUF_SZ : uint = 1000u;
8370
static BUF_BYTES : uint = 2048u;
8471

85-
#[cfg(unix)]
8672
pub fn getcwd() -> Path {
8773
#[fixed_stack_segment]; #[inline(never)];
8874
let mut buf = [0 as libc::c_char, ..BUF_BYTES];
@@ -97,22 +83,6 @@ pub fn getcwd() -> Path {
9783
}
9884
}
9985

100-
#[cfg(windows)]
101-
pub fn getcwd() -> Path {
102-
#[fixed_stack_segment]; #[inline(never)];
103-
use libc::DWORD;
104-
use libc::GetCurrentDirectoryW;
105-
let mut buf = [0 as u16, ..BUF_BYTES];
106-
do buf.as_mut_buf |buf, len| {
107-
unsafe {
108-
if libc::GetCurrentDirectoryW(len as DWORD, buf) == 0 as DWORD {
109-
fail2!();
110-
}
111-
}
112-
}
113-
Path::new(str::from_utf16(buf))
114-
}
115-
11686
#[cfg(windows)]
11787
pub mod win32 {
11888
use libc;
@@ -643,7 +613,6 @@ pub fn walk_dir(p: &Path, f: &fn(&Path) -> bool) -> bool {
643613
})
644614
}
645615
646-
#[cfg(unix)]
647616
/// Indicates whether a path represents a directory
648617
pub fn path_is_dir(p: &Path) -> bool {
649618
#[fixed_stack_segment]; #[inline(never)];
@@ -654,18 +623,6 @@ pub fn path_is_dir(p: &Path) -> bool {
654623
}
655624
}
656625
657-
658-
#[cfg(windows)]
659-
pub fn path_is_dir(p: &Path) -> bool {
660-
#[fixed_stack_segment]; #[inline(never)];
661-
unsafe {
662-
do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| {
663-
rustrt::rust_path_is_dir_u16(buf) != 0 as c_int
664-
}
665-
}
666-
}
667-
668-
#[cfg(unix)]
669626
/// Indicates whether a path exists
670627
pub fn path_exists(p: &Path) -> bool {
671628
#[fixed_stack_segment]; #[inline(never)];
@@ -676,16 +633,6 @@ pub fn path_exists(p: &Path) -> bool {
676633
}
677634
}
678635
679-
#[cfg(windows)]
680-
pub fn path_exists(p: &Path) -> bool {
681-
#[fixed_stack_segment]; #[inline(never)];
682-
unsafe {
683-
do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| {
684-
rustrt::rust_path_exists_u16(buf) != 0 as c_int
685-
}
686-
}
687-
}
688-
689636
/**
690637
* Convert a relative path to an absolute path
691638
*
@@ -1975,47 +1922,15 @@ mod tests {
19751922
19761923
#[test]
19771924
fn path_is_dir() {
1978-
use rt::io::file::open;
1979-
use rt::io::{OpenOrCreate, Read};
1980-
19811925
assert!((os::path_is_dir(&Path::new("."))));
19821926
assert!((!os::path_is_dir(&Path::new("test/stdtest/fs.rs"))));
1983-
1984-
let mut dirpath = os::tmpdir();
1985-
dirpath.push(format!("rust-test-{}/test-\uac00\u4e00\u30fc\u4f60\u597d",
1986-
rand::random::<u32>())); // 가一ー你好
1987-
debug2!("path_is_dir dirpath: {}", dirpath.display());
1988-
1989-
let mkdir_result = os::mkdir_recursive(&dirpath, (S_IRUSR | S_IWUSR | S_IXUSR) as i32);
1990-
debug2!("path_is_dir mkdir_result: {}", mkdir_result);
1991-
1992-
assert!((os::path_is_dir(&dirpath)));
1993-
1994-
let mut filepath = dirpath;
1995-
filepath.push("unicode-file-\uac00\u4e00\u30fc\u4f60\u597d.rs");
1996-
debug2!("path_is_dir filepath: {}", filepath.display());
1997-
1998-
open(&filepath, OpenOrCreate, Read); // ignore return; touch only
1999-
assert!((!os::path_is_dir(&filepath)));
2000-
2001-
assert!((!os::path_is_dir(&Path::new(
2002-
"test/unicode-bogus-dir-\uac00\u4e00\u30fc\u4f60\u597d"))));
20031927
}
20041928
20051929
#[test]
20061930
fn path_exists() {
20071931
assert!((os::path_exists(&Path::new("."))));
20081932
assert!((!os::path_exists(&Path::new(
20091933
"test/nonexistent-bogus-path"))));
2010-
2011-
let mut dirpath = os::tmpdir();
2012-
dirpath.push(format!("rust-test-{}/test-\uac01\u4e01\u30fc\u518d\u89c1",
2013-
rand::random::<u32>())); // 각丁ー再见
2014-
2015-
os::mkdir_recursive(&dirpath, (S_IRUSR | S_IWUSR | S_IXUSR) as i32);
2016-
assert!((os::path_exists(&dirpath)));
2017-
assert!((!os::path_exists(&Path::new(
2018-
"test/unicode-bogus-path-\uac01\u4e01\u30fc\u518d\u89c1"))));
20191934
}
20201935
20211936
#[test]

branches/try2/src/rt/rust_builtin.cpp

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ rust_list_dir_wfd_fp_buf(void* wfd) {
106106
#endif
107107

108108
extern "C" CDECL int
109-
rust_path_is_dir(const char *path) {
109+
rust_path_is_dir(char *path) {
110110
struct stat buf;
111111
if (stat(path, &buf)) {
112112
return 0;
@@ -115,48 +115,14 @@ rust_path_is_dir(const char *path) {
115115
}
116116

117117
extern "C" CDECL int
118-
#if defined(__WIN32__)
119-
rust_path_is_dir_u16(const wchar_t *path) {
120-
struct _stat buf;
121-
// Don't use GetFileAttributesW, it cannot get attributes of
122-
// some system files (e.g. pagefile.sys).
123-
if (_wstat(path, &buf)) {
124-
return 0;
125-
}
126-
return S_ISDIR(buf.st_mode);
127-
}
128-
#else
129-
rust_path_is_dir_u16(const void *path) {
130-
// Wide version of function is only used on Windows.
131-
return 0;
132-
}
133-
#endif
134-
135-
extern "C" CDECL int
136-
rust_path_exists(const char *path) {
118+
rust_path_exists(char *path) {
137119
struct stat buf;
138120
if (stat(path, &buf)) {
139121
return 0;
140122
}
141123
return 1;
142124
}
143125

144-
extern "C" CDECL int
145-
#if defined(__WIN32__)
146-
rust_path_exists_u16(const wchar_t *path) {
147-
struct _stat buf;
148-
if (_wstat(path, &buf)) {
149-
return 0;
150-
}
151-
return 1;
152-
}
153-
#else
154-
rust_path_exists_u16(const void *path) {
155-
// Wide version of function is only used on Windows.
156-
return 0;
157-
}
158-
#endif
159-
160126
extern "C" CDECL FILE* rust_get_stdin() {return stdin;}
161127
extern "C" CDECL FILE* rust_get_stdout() {return stdout;}
162128
extern "C" CDECL FILE* rust_get_stderr() {return stderr;}
@@ -327,12 +293,8 @@ rust_localtime(int64_t sec, int32_t nsec, rust_tm *timeptr) {
327293
const char* zone = NULL;
328294
#if defined(__WIN32__)
329295
int32_t gmtoff = -timezone;
330-
wchar_t wbuffer[64];
331-
char buffer[256];
332-
// strftime("%Z") can contain non-UTF-8 characters on non-English locale (issue #9418),
333-
// so time zone should be converted from UTF-16 string set by wcsftime.
334-
if (wcsftime(wbuffer, sizeof(wbuffer) / sizeof(wchar_t), L"%Z", &tm) > 0) {
335-
WideCharToMultiByte(CP_UTF8, 0, wbuffer, -1, buffer, sizeof(buffer), NULL, NULL);
296+
char buffer[64];
297+
if (strftime(buffer, sizeof(buffer), "%Z", &tm) > 0) {
336298
zone = buffer;
337299
}
338300
#else

branches/try2/src/rt/rust_globals.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@
5454
#include <assert.h>
5555

5656
#if defined(__WIN32__)
57-
// Prevent unnecessary #include's from <windows.h>
58-
#ifndef WIN32_LEAN_AND_MEAN
59-
#define WIN32_LEAN_AND_MEAN
60-
#endif
61-
// Prevent defining min and max macro
62-
#ifndef NOMINMAX
63-
#define NOMINMAX
64-
#endif
6557
extern "C" {
6658
#include <windows.h>
6759
#include <tchar.h>

branches/try2/src/rt/rustrt.def.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ rust_timegm
1010
rust_mktime
1111
precise_time_ns
1212
rust_path_is_dir
13-
rust_path_is_dir_u16
1413
rust_path_exists
15-
rust_path_exists_u16
1614
rust_get_stdin
1715
rust_get_stdout
1816
rust_get_stderr

branches/try2/src/test/run-fail/glob-use-std.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)