Skip to content

Commit 8df802f

Browse files
committed
---
yaml --- r: 212303 b: refs/heads/auto c: e5c92b9 h: refs/heads/master i: 212301: 0140d2b 212299: 08b2fcd 212295: 67b6348 212287: d07e094 v: v3
1 parent 7ca9b1b commit 8df802f

File tree

12 files changed

+40
-20
lines changed

12 files changed

+40
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: f0fed8388690ea4f94efda53880a5441da3c0c85
13+
refs/heads/auto: e5c92b981de9c2d6ff08c31c419e52a322f813af
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
770770
ast::ExprAssign(..) |
771771
ast::ExprAssignOp(..) |
772772
ast::ExprInlineAsm(_) |
773-
ast::ExprMac(_) => {
773+
ast::ExprMac(_, _) => {
774774
v.add_qualif(ConstQualif::NOT_CONST);
775775
if v.mode != Mode::Var {
776776
span_err!(v.tcx.sess, e.span, E0019,

branches/auto/src/librustc_trans/trans/debuginfo/create_scope_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ fn walk_expr(cx: &CrateContext,
414414
Found unexpanded for loop.");
415415
}
416416

417-
ast::ExprMac(_) => {
417+
ast::ExprMac(..) => {
418418
cx.sess().span_bug(exp.span, "debuginfo::create_scope_map() - \
419419
Found unexpanded macro.");
420420
}
@@ -511,4 +511,4 @@ fn walk_expr(cx: &CrateContext,
511511
}
512512
}
513513
}
514-
}
514+
}

branches/auto/src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3303,7 +3303,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
33033303
}
33043304
fcx.write_nil(id);
33053305
}
3306-
ast::ExprMac(_) => tcx.sess.bug("unexpanded macro"),
3306+
ast::ExprMac(..) => tcx.sess.bug("unexpanded macro"),
33073307
ast::ExprBreak(_) => { fcx.write_ty(id, fcx.infcx().next_diverging_ty_var()); }
33083308
ast::ExprAgain(_) => { fcx.write_ty(id, fcx.infcx().next_diverging_ty_var()); }
33093309
ast::ExprRet(ref expr_opt) => {

branches/auto/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ pub enum Expr_ {
892892
ExprInlineAsm(InlineAsm),
893893

894894
/// A macro invocation; pre-expansion
895-
ExprMac(Mac),
895+
ExprMac(Mac, token::DelimToken),
896896

897897
/// A struct literal expression.
898898
///

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
4949
e.and_then(|ast::Expr {id, node, span}| match node {
5050
// expr_mac should really be expr_ext or something; it's the
5151
// entry-point for all syntax extensions.
52-
ast::ExprMac(mac) => {
52+
ast::ExprMac(mac, _) => {
5353
let expanded_expr = match expand_mac_invoc(mac, span,
5454
|r| r.make_expr(),
5555
mark_expr, fld) {

branches/auto/src/libsyntax/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
13211321
dialect: dialect,
13221322
expn_id: expn_id,
13231323
}),
1324-
ExprMac(mac) => ExprMac(folder.fold_mac(mac)),
1324+
ExprMac(mac, delim) => ExprMac(folder.fold_mac(mac), delim),
13251325
ExprStruct(path, fields, maybe_expr) => {
13261326
ExprStruct(folder.fold_path(path),
13271327
fields.move_map(|x| folder.fold_field(x)),

branches/auto/src/libsyntax/parse/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ mod tests {
10781078
"foo!( fn main() { body } )".to_string(), vec![], &sess);
10791079

10801080
let tts = match expr.node {
1081-
ast::ExprMac(ref mac) => {
1081+
ast::ExprMac(ref mac, _) => {
10821082
let ast::MacInvocTT(_, ref tts, _) = mac.node;
10831083
tts.clone()
10841084
}

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,10 +1942,14 @@ impl<'a> Parser<'a> {
19421942
ExprAssignOp(binop, lhs, rhs)
19431943
}
19441944

1945-
pub fn mk_mac_expr(&mut self, lo: BytePos, hi: BytePos, m: Mac_) -> P<Expr> {
1945+
pub fn mk_mac_expr(&mut self,
1946+
lo: BytePos,
1947+
hi: BytePos,
1948+
m: Mac_,
1949+
delim: token::DelimToken) -> P<Expr> {
19461950
P(Expr {
19471951
id: ast::DUMMY_NODE_ID,
1948-
node: ExprMac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}),
1952+
node: ExprMac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}, delim),
19491953
span: mk_sp(lo, hi),
19501954
})
19511955
}
@@ -2166,9 +2170,8 @@ impl<'a> Parser<'a> {
21662170

21672171
return Ok(self.mk_mac_expr(lo,
21682172
hi,
2169-
MacInvocTT(pth,
2170-
tts,
2171-
EMPTY_CTXT)));
2173+
MacInvocTT(pth, tts, EMPTY_CTXT),
2174+
delim));
21722175
}
21732176
if self.check(&token::OpenDelim(token::Brace)) {
21742177
// This is a struct literal, unless we're prohibited
@@ -3610,8 +3613,10 @@ impl<'a> Parser<'a> {
36103613
try!(self.bump());
36113614
}
36123615
_ => {
3613-
let e = self.mk_mac_expr(span.lo, span.hi,
3614-
mac.and_then(|m| m.node));
3616+
let e = self.mk_mac_expr(span.lo,
3617+
span.hi,
3618+
mac.and_then(|m| m.node),
3619+
token::Brace);
36153620
let e = try!(self.parse_dot_or_call_expr_with(e));
36163621
let e = try!(self.parse_more_binops(e, 0));
36173622
let e = try!(self.parse_assign_expr_with(e));
@@ -3636,8 +3641,10 @@ impl<'a> Parser<'a> {
36363641
token::CloseDelim(token::Brace) => {
36373642
// if a block ends in `m!(arg)` without
36383643
// a `;`, it must be an expr
3639-
expr = Some(self.mk_mac_expr(span.lo, span.hi,
3640-
m.and_then(|x| x.node)));
3644+
expr = Some(self.mk_mac_expr(span.lo,
3645+
span.hi,
3646+
m.and_then(|x| x.node),
3647+
token::Brace));
36413648
}
36423649
_ => {
36433650
stmts.push(P(Spanned {

branches/auto/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,7 @@ impl<'a> State<'a> {
19691969

19701970
try!(self.pclose());
19711971
}
1972-
ast::ExprMac(ref m) => try!(self.print_mac(m, token::Paren)),
1972+
ast::ExprMac(ref m, delim) => try!(self.print_mac(m, delim)),
19731973
ast::ExprParen(ref e) => {
19741974
try!(self.popen());
19751975
try!(self.print_expr(&**e));

branches/auto/src/libsyntax/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
852852
ExprRet(ref optional_expression) => {
853853
walk_expr_opt(visitor, optional_expression)
854854
}
855-
ExprMac(ref mac) => visitor.visit_mac(mac),
855+
ExprMac(ref mac, _) => visitor.visit_mac(mac),
856856
ExprParen(ref subexpression) => {
857857
visitor.visit_expr(&**subexpression)
858858
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2015 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+
// Testing that expression macros with brackets pretty prints correctly
12+
// pp-exact
13+
fn main() { println!{"hello world" } () }

0 commit comments

Comments
 (0)