Skip to content

Commit 3a07193

Browse files
committed
---
yaml --- r: 146067 b: refs/heads/try2 c: ebb9b46 h: refs/heads/master i: 146065: a2f9f75 146063: 88f761c v: v3
1 parent 5e87c81 commit 3a07193

File tree

6 files changed

+63
-26
lines changed

6 files changed

+63
-26
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: 45334326127285e9442ae1c3e9f4ba9c428ec3c6
8+
refs/heads/try2: ebb9b461914347950592f9a2d4e53e324f2f1238
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

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

11+
use fmt;
1112
use libc;
1213
use option::{Option, Some, None};
1314
use result::{Ok, Err};
@@ -56,7 +57,9 @@ pub fn stderr() -> StdWriter {
5657
pub fn print(s: &str) {
5758
// XXX: need to see if not caching stdin() is the cause of performance
5859
// issues, it should be possible to cache a stdout handle in each Task
59-
// and then re-use that across calls to print/println
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.
6063
stdout().write(s.as_bytes());
6164
}
6265

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

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+
7188
/// Representation of a reader of a standard input stream
7289
pub struct StdReader {
7390
priv inner: ~RtioFileStream

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,16 +999,11 @@ 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!
10051002
macro_rules! print (
1006-
($($arg:tt)*) => (::std::io::print(format!($($arg)*)))
1003+
($($arg:tt)*) => (format_args!(::std::rt::io::stdio::print_args, $($arg)*))
10071004
)
1008-
// FIXME(#6846) once stdio is redesigned, this shouldn't perform an
1009-
// allocation but should rather delegate to an io::Writer
10101005
macro_rules! println (
1011-
($($arg:tt)*) => (::std::io::println(format!($($arg)*)))
1006+
($($arg:tt)*) => (format_args!(::std::rt::io::stdio::println_args, $($arg)*))
10121007
)
10131008

10141009
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
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-test
12+
13+
fn main() {
14+
unsafe {
15+
asm!(""); //~ ERROR inline assembly is not stable enough
16+
}
17+
}

0 commit comments

Comments
 (0)