Skip to content

Commit f5ab535

Browse files
committed
---
yaml --- r: 146064 b: refs/heads/try2 c: c5346fe h: refs/heads/master v: v3
1 parent 88f761c commit f5ab535

File tree

12 files changed

+65
-191
lines changed

12 files changed

+65
-191
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: 04ac697f529136abec5e6e7cc888fef1afbf1c4b
8+
refs/heads/try2: c5346fea38ed391c7ea83b3d03354904f0f3bd39
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_passes(fpm, mpm, llmod, OptLevel);
300+
populate_llvm_passess(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_passes(fpm: lib::llvm::PassManagerRef,
426-
mpm: lib::llvm::PassManagerRef,
427-
llmod: ModuleRef,
428-
opt: lib::llvm::CodeGenOptLevel) {
425+
unsafe fn populate_llvm_passess(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/librustc/front/feature_gate.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
3434
("macro_rules", Active),
3535
("struct_variant", Active),
3636
("once_fns", Active),
37+
("asm", Active),
3738

3839
// These are used to test this portion of the compiler, they don't actually
3940
// mean anything
@@ -108,26 +109,29 @@ impl Visitor<()> for Context {
108109
}
109110
}
110111

111-
ast::item_mac(ref mac) => {
112-
match mac.node {
113-
ast::mac_invoc_tt(ref path, _, _) => {
114-
let rules = self.sess.ident_of("macro_rules");
115-
if path.segments.last().identifier == rules {
116-
self.gate_feature("macro_rules", i.span,
117-
"macro definitions are not \
118-
stable enough for use and are \
119-
subject to change");
120-
}
121-
}
122-
}
123-
}
124-
125112
_ => {}
126113
}
127114

128115
visit::walk_item(self, i, ());
129116
}
130117

118+
fn visit_mac(&mut self, macro: &ast::mac, _: ()) {
119+
let ast::mac_invoc_tt(ref path, _, _) = macro.node;
120+
121+
if path.segments.last().identifier == self.sess.ident_of("macro_rules") {
122+
self.gate_feature("macro_rules", path.span, "macro definitions are \
123+
not stable enough for use and are subject to change");
124+
}
125+
126+
else if path.segments.last().identifier == self.sess.ident_of("asm") {
127+
// NOTE: remove the false once the ASM feature is in the next snapshot
128+
if false {
129+
self.gate_feature("asm", path.span, "inline assembly is not \
130+
stable enough for use and is subject to change");
131+
}
132+
}
133+
}
134+
131135
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {
132136
match t.node {
133137
ast::ty_closure(closure) if closure.onceness == ast::Once => {

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/libstd/rt/io/stdio.rs

Lines changed: 1 addition & 18 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 fmt;
1211
use libc;
1312
use option::{Option, Some, None};
1413
use result::{Ok, Err};
@@ -57,9 +56,7 @@ pub fn stderr() -> StdWriter {
5756
pub fn print(s: &str) {
5857
// XXX: need to see if not caching stdin() is the cause of performance
5958
// issues, it should be possible to cache a stdout handle in each Task
60-
// and then re-use that across calls to print/println. Note that the
61-
// resolution of this comment will affect all of the prints below as
62-
// well.
59+
// and then re-use that across calls to print/println
6360
stdout().write(s.as_bytes());
6461
}
6562

@@ -71,20 +68,6 @@ pub fn println(s: &str) {
7168
out.write(['\n' as u8]);
7269
}
7370

74-
/// Similar to `print`, but takes a `fmt::Arguments` structure to be compatible
75-
/// with the `format_args!` macro.
76-
pub fn print_args(fmt: &fmt::Arguments) {
77-
let mut out = stdout();
78-
fmt::write(&mut out as &mut Writer, fmt);
79-
}
80-
81-
/// Similar to `println`, but takes a `fmt::Arguments` structure to be
82-
/// compatible with the `format_args!` macro.
83-
pub fn println_args(fmt: &fmt::Arguments) {
84-
let mut out = stdout();
85-
fmt::writeln(&mut out as &mut Writer, fmt);
86-
}
87-
8871
/// Representation of a reader of a standard input stream
8972
pub struct StdReader {
9073
priv inner: ~RtioFileStream

branches/try2/src/libsyntax/ext/expand.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,11 +999,16 @@ pub fn std_macros() -> @str {
999999
macro_rules! writeln(($dst:expr, $($arg:tt)*) => (
10001000
format_args!(|args| { ::std::fmt::writeln($dst, args) }, $($arg)*)
10011001
))
1002+
// FIXME(#6846) once stdio is redesigned, this shouldn't perform an
1003+
// allocation but should rather delegate to an invocation of
1004+
// write! instead of format!
10021005
macro_rules! print (
1003-
($($arg:tt)*) => (format_args!(::std::rt::io::stdio::print_args, $($arg)*))
1006+
($($arg:tt)*) => (::std::io::print(format!($($arg)*)))
10041007
)
1008+
// FIXME(#6846) once stdio is redesigned, this shouldn't perform an
1009+
// allocation but should rather delegate to an io::Writer
10051010
macro_rules! println (
1006-
($($arg:tt)*) => (format_args!(::std::rt::io::stdio::println_args, $($arg)*))
1011+
($($arg:tt)*) => (::std::io::println(format!($($arg)*)))
10071012
)
10081013

10091014
macro_rules! local_data_key (

branches/try2/src/libsyntax/visit.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub trait Visitor<E:Clone> {
9090
walk_struct_def(self, s, i, g, n, e)
9191
}
9292
fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) }
93+
fn visit_mac(&mut self, m:&mac, e:E) { walk_mac(self, m, e); }
9394
}
9495

9596
impl<E:Clone> Visitor<E> for @mut Visitor<E> {
@@ -150,6 +151,9 @@ impl<E:Clone> Visitor<E> for @mut Visitor<E> {
150151
fn visit_struct_field(&mut self, a:@struct_field, e:E) {
151152
(*self).visit_struct_field(a, e)
152153
}
154+
fn visit_mac(&mut self, macro:&mac, e:E) {
155+
(*self).visit_mac(macro, e);
156+
}
153157
}
154158

155159
pub fn walk_crate<E:Clone, V:Visitor<E>>(visitor: &mut V, crate: &Crate, env: E) {
@@ -247,7 +251,7 @@ pub fn walk_item<E:Clone, V:Visitor<E>>(visitor: &mut V, item: &item, env: E) {
247251
visitor.visit_trait_method(method, env.clone())
248252
}
249253
}
250-
item_mac(ref macro) => walk_mac(visitor, macro, env),
254+
item_mac(ref macro) => visitor.visit_mac(macro, env),
251255
}
252256
}
253257

@@ -507,7 +511,7 @@ pub fn walk_stmt<E:Clone, V:Visitor<E>>(visitor: &mut V, statement: &Stmt, env:
507511
StmtExpr(expression, _) | StmtSemi(expression, _) => {
508512
visitor.visit_expr(expression, env)
509513
}
510-
StmtMac(ref macro, _) => walk_mac(visitor, macro, env),
514+
StmtMac(ref macro, _) => visitor.visit_mac(macro, env),
511515
}
512516
}
513517

@@ -644,7 +648,7 @@ pub fn walk_expr<E:Clone, V:Visitor<E>>(visitor: &mut V, expression: @Expr, env:
644648
walk_expr_opt(visitor, optional_expression, env.clone())
645649
}
646650
ExprLogLevel => {}
647-
ExprMac(ref macro) => walk_mac(visitor, macro, env.clone()),
651+
ExprMac(ref macro) => visitor.visit_mac(macro, env.clone()),
648652
ExprParen(subexpression) => {
649653
visitor.visit_expr(subexpression, env.clone())
650654
}

0 commit comments

Comments
 (0)