Skip to content

Commit 4a6d318

Browse files
committed
---
yaml --- r: 106227 b: refs/heads/auto c: 57ac379 h: refs/heads/master i: 106225: 7056307 106223: 403f774 v: v3
1 parent 06f4f6e commit 4a6d318

File tree

13 files changed

+52
-130
lines changed

13 files changed

+52
-130
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: f8f60d80bf573cd8b4b5680b44c9cabe2b862f78
16+
refs/heads/auto: 57ac379a630d9756c71f2747debe1756ccf62c5f
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/rust.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3446,8 +3446,9 @@ The kinds are:
34463446
This kind includes scalars and immutable references,
34473447
as well as structural types containing other `Pod` types.
34483448
`'static`
3449-
: Types of this kind do not contain any references;
3450-
this can be a useful guarantee for code
3449+
: Types of this kind do not contain any references (except for
3450+
references with the `static` lifetime, which are allowed).
3451+
This can be a useful guarantee for code
34513452
that breaks borrowing assumptions
34523453
using [`unsafe` operations](#unsafe-functions).
34533454
`Drop`

branches/auto/src/libsyntax/ext/base.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,31 +119,13 @@ impl MacResult {
119119
pub fn raw_dummy_expr(sp: codemap::Span) -> @ast::Expr {
120120
@ast::Expr {
121121
id: ast::DUMMY_NODE_ID,
122-
node: ast::ExprLit(@codemap::respan(sp, ast::LitNil)),
123-
span: sp,
122+
node: ast::ExprTup(Vec::new()),
123+
span: sp
124124
}
125125
}
126126
pub fn dummy_expr(sp: codemap::Span) -> MacResult {
127127
MRExpr(MacResult::raw_dummy_expr(sp))
128128
}
129-
pub fn dummy_any(sp: codemap::Span) -> MacResult {
130-
MRAny(~DummyMacResult { sp: sp })
131-
}
132-
}
133-
struct DummyMacResult {
134-
sp: codemap::Span
135-
}
136-
impl AnyMacro for DummyMacResult {
137-
fn make_expr(&self) -> @ast::Expr {
138-
MacResult::raw_dummy_expr(self.sp)
139-
}
140-
fn make_items(&self) -> SmallVector<@ast::Item> {
141-
SmallVector::zero()
142-
}
143-
fn make_stmt(&self) -> @ast::Stmt {
144-
@codemap::respan(self.sp,
145-
ast::StmtExpr(MacResult::raw_dummy_expr(self.sp), ast::DUMMY_NODE_ID))
146-
}
147129
}
148130

149131
/// An enum representing the different kinds of syntax extensions.

branches/auto/src/libsyntax/ext/log_syntax.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
use ast;
1212
use codemap;
13+
use ext::base::*;
1314
use ext::base;
1415
use print;
1516

16-
pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
17+
pub fn expand_syntax_ext(cx: &mut ExtCtxt,
1718
sp: codemap::Span,
1819
tt: &[ast::TokenTree])
1920
-> base::MacResult {
@@ -22,6 +23,13 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
2223
println!("{}", print::pprust::tt_to_str(&ast::TTDelim(
2324
@tt.iter().map(|x| (*x).clone()).collect())));
2425

25-
// any so that `log_syntax` can be invoked as an expression and item.
26-
base::MacResult::dummy_any(sp)
26+
//trivial expression
27+
MRExpr(@ast::Expr {
28+
id: ast::DUMMY_NODE_ID,
29+
node: ast::ExprLit(@codemap::Spanned {
30+
node: ast::LitNil,
31+
span: sp
32+
}),
33+
span: sp,
34+
})
2735
}

branches/auto/src/libsyntax/ext/trace_macros.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,33 @@ use ast;
1212
use codemap::Span;
1313
use ext::base::ExtCtxt;
1414
use ext::base;
15-
use parse::token::{keywords, is_keyword};
15+
use parse::lexer::{new_tt_reader, Reader};
16+
use parse::parser::Parser;
17+
use parse::token::keywords;
1618

1719
pub fn expand_trace_macros(cx: &mut ExtCtxt,
1820
sp: Span,
1921
tt: &[ast::TokenTree])
2022
-> base::MacResult {
21-
match tt {
22-
[ast::TTTok(_, ref tok)] if is_keyword(keywords::True, tok) => {
23-
cx.set_trace_macros(true);
24-
}
25-
[ast::TTTok(_, ref tok)] if is_keyword(keywords::False, tok) => {
26-
cx.set_trace_macros(false);
27-
}
28-
_ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"),
23+
let sess = cx.parse_sess();
24+
let cfg = cx.cfg();
25+
let tt_rdr = new_tt_reader(&cx.parse_sess().span_diagnostic,
26+
None,
27+
tt.iter().map(|x| (*x).clone()).collect());
28+
let mut rust_parser = Parser(sess, cfg.clone(), tt_rdr.dup());
29+
30+
if rust_parser.is_keyword(keywords::True) {
31+
cx.set_trace_macros(true);
32+
} else if rust_parser.is_keyword(keywords::False) {
33+
cx.set_trace_macros(false);
34+
} else {
35+
cx.span_err(sp, "trace_macros! only accepts `true` or `false`");
36+
return base::MacResult::dummy_expr(sp);
2937
}
3038

31-
base::MacResult::dummy_any(sp)
39+
rust_parser.bump();
40+
41+
let mut rust_parser = Parser(sess, cfg, tt_rdr.dup());
42+
let result = rust_parser.parse_expr();
43+
base::MRExpr(result)
3244
}

branches/auto/src/libterm/lib.rs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
html_root_url = "http://static.rust-lang.org/doc/master")];
2121

2222
#[feature(macro_rules)];
23-
#[deny(missing_doc)];
2423

2524
extern crate collections;
2625

@@ -35,9 +34,7 @@ pub mod terminfo;
3534

3635
// FIXME (#2807): Windows support.
3736

38-
/// Terminal color definitions
3937
pub mod color {
40-
/// Number for a terminal color
4138
pub type Color = u16;
4239

4340
pub static BLACK: Color = 0u16;
@@ -59,10 +56,8 @@ pub mod color {
5956
pub static BRIGHT_WHITE: Color = 15u16;
6057
}
6158

62-
/// Terminal attributes
6359
pub mod attr {
6460
/// Terminal attributes for use with term.attr().
65-
///
6661
/// Most attributes can only be turned on and must be turned off with term.reset().
6762
/// The ones that can be turned off explicitly take a boolean value.
6863
/// Color is also represented as an attribute for convenience.
@@ -108,23 +103,13 @@ fn cap_for_attr(attr: attr::Attr) -> &'static str {
108103
}
109104
}
110105

111-
/// A Terminal that knows how many colors it supports, with a reference to its
112-
/// parsed TermInfo database record.
113106
pub struct Terminal<T> {
114107
priv num_colors: u16,
115108
priv out: T,
116109
priv ti: ~TermInfo
117110
}
118111

119112
impl<T: Writer> Terminal<T> {
120-
/// Returns a wrapped output stream (`Terminal<T>`) as a `Result`.
121-
///
122-
/// Returns `Err()` if the TERM environment variable is undefined.
123-
/// TERM should be set to something like `xterm-color` or `screen-256color`.
124-
///
125-
/// Returns `Err()` on failure to open the terminfo database correctly.
126-
/// Also, in the event that the individual terminfo database entry can not
127-
/// be parsed.
128113
pub fn new(out: T) -> Result<Terminal<T>, ~str> {
129114
let term = match os::getenv("TERM") {
130115
Some(t) => t,
@@ -158,8 +143,8 @@ impl<T: Writer> Terminal<T> {
158143
/// If the color is a bright color, but the terminal only supports 8 colors,
159144
/// the corresponding normal color will be used instead.
160145
///
161-
/// Returns `Ok(true)` if the color was set, `Ok(false)` otherwise, and `Err(e)`
162-
/// if there was an I/O error.
146+
/// Returns Ok(true) if the color was set, Ok(false) otherwise, and Err(e)
147+
/// if there was an I/O error
163148
pub fn fg(&mut self, color: color::Color) -> io::IoResult<bool> {
164149
let color = self.dim_if_necessary(color);
165150
if self.num_colors > color {
@@ -181,8 +166,8 @@ impl<T: Writer> Terminal<T> {
181166
/// If the color is a bright color, but the terminal only supports 8 colors,
182167
/// the corresponding normal color will be used instead.
183168
///
184-
/// Returns `Ok(true)` if the color was set, `Ok(false)` otherwise, and `Err(e)`
185-
/// if there was an I/O error.
169+
/// Returns Ok(true) if the color was set, Ok(false) otherwise, and Err(e)
170+
/// if there was an I/O error
186171
pub fn bg(&mut self, color: color::Color) -> io::IoResult<bool> {
187172
let color = self.dim_if_necessary(color);
188173
if self.num_colors > color {
@@ -201,8 +186,8 @@ impl<T: Writer> Terminal<T> {
201186
}
202187

203188
/// Sets the given terminal attribute, if supported.
204-
/// Returns `Ok(true)` if the attribute was supported, `Ok(false)` otherwise,
205-
/// and `Err(e)` if there was an I/O error.
189+
/// Returns Ok(true) if the attribute was supported, Ok(false) otherwise,
190+
/// and Err(e) if there was an I/O error.
206191
pub fn attr(&mut self, attr: attr::Attr) -> io::IoResult<bool> {
207192
match attr {
208193
attr::ForegroundColor(c) => self.fg(c),
@@ -238,7 +223,6 @@ impl<T: Writer> Terminal<T> {
238223
}
239224

240225
/// Resets all terminal attributes and color to the default.
241-
/// Returns `Ok()`.
242226
pub fn reset(&mut self) -> io::IoResult<()> {
243227
let mut cap = self.ti.strings.find_equiv(&("sgr0"));
244228
if cap.is_none() {
@@ -264,13 +248,10 @@ impl<T: Writer> Terminal<T> {
264248
} else { color }
265249
}
266250

267-
/// Returns the contained stream
268251
pub fn unwrap(self) -> T { self.out }
269252

270-
/// Gets an immutable reference to the stream inside
271253
pub fn get_ref<'a>(&'a self) -> &'a T { &self.out }
272254

273-
/// Gets a mutable reference to the stream inside
274255
pub fn get_mut<'a>(&'a mut self) -> &'a mut T { &mut self.out }
275256
}
276257

branches/auto/src/libterm/terminfo/mod.rs

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

11-
//! Terminfo database interface.
11+
#[allow(missing_doc)];
1212

1313
use collections::HashMap;
1414

15-
/// A parsed terminfo database entry.
15+
/// A parsed terminfo entry.
1616
pub struct TermInfo {
1717
/// Names for the terminal
1818
priv names: Vec<~str> ,
@@ -25,10 +25,7 @@ pub struct TermInfo {
2525
}
2626

2727
pub mod searcher;
28-
29-
/// TermInfo format parsing.
3028
pub mod parser {
31-
//! ncurses-compatible compiled terminfo format parsing (term(5))
3229
pub mod compiled;
3330
}
3431
pub mod parm;

branches/auto/src/libterm/terminfo/parm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ enum FormatState {
3838
}
3939

4040
/// Types of parameters a capability can use
41-
#[allow(missing_doc)]
4241
#[deriving(Clone)]
42+
#[allow(missing_doc)]
4343
pub enum Param {
4444
String(~str),
4545
Number(int)

branches/auto/src/libterm/terminfo/parser/compiled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#[allow(non_uppercase_statics)];
1212

13-
//! ncurses-compatible compiled terminfo format parsing (term(5))
13+
/// ncurses-compatible compiled terminfo format parsing (term(5))
1414
1515
use collections::HashMap;
1616
use std::io;

branches/auto/src/libterm/terminfo/searcher.rs

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

11-
//! ncurses-compatible database discovery
12-
//!
13-
//! Does not support hashed database, only filesystem!
11+
/// Implement ncurses-compatible database discovery
12+
/// Does not support hashed database, only filesystem!
1413
1514
use std::io::File;
1615
use std::os::getenv;

branches/auto/src/test/compile-fail/issue-11692.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ fn main() {
1515

1616
concat!(test!());
1717
//~^ ERROR: macro undefined: 'test'
18+
//~^^ ERROR: expected a literal
1819
}

branches/auto/src/test/compile-fail/trace_macros-format.rs

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

branches/auto/src/test/run-pass/log_syntax-trace_macros-macro-locations.rs

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

0 commit comments

Comments
 (0)