Skip to content

Commit d7fe9f0

Browse files
committed
---
yaml --- r: 102322 b: refs/heads/master c: 6a6d933 h: refs/heads/master v: v3
1 parent d9df5d2 commit d7fe9f0

File tree

11 files changed

+30
-48
lines changed

11 files changed

+30
-48
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 813544fd079dea80a1eb6d4ee56f234058d579ac
2+
refs/heads/master: 6a6d933af3862d650498b19d1b18caae98966edb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/src/libsyntax/ext/base.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,11 @@ impl<'a> ExtCtxt<'a> {
405405
}
406406
}
407407

408-
/// Extract a string literal from the macro expanded version of `expr`,
409-
/// emitting `err_msg` if `expr` is not a string literal. This does not stop
410-
/// compilation on error, merely emits a non-fatal error and returns None.
411-
pub fn expr_to_str(cx: &mut ExtCtxt, expr: @ast::Expr, err_msg: &str)
408+
/// Extract a string literal from `expr`, emitting `err_msg` if `expr`
409+
/// is not a string literal. This does not stop compilation on error,
410+
/// merely emits a non-fatal error and returns None.
411+
pub fn expr_to_str(cx: &ExtCtxt, expr: @ast::Expr, err_msg: &str)
412412
-> Option<(InternedString, ast::StrStyle)> {
413-
// we want to be able to handle e.g. concat("foo", "bar")
414-
let expr = cx.expand_expr(expr);
415413
match expr.node {
416414
ast::ExprLit(l) => match l.node {
417415
ast::LitStr(ref s, style) => return Some(((*s).clone(), style)),
@@ -459,7 +457,7 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
459457

460458
/// Extract comma-separated expressions from `tts`. If there is a
461459
/// parsing error, emit a non-fatal error and return None.
462-
pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
460+
pub fn get_exprs_from_tts(cx: &ExtCtxt,
463461
sp: Span,
464462
tts: &[ast::TokenTree]) -> Option<Vec<@ast::Expr> > {
465463
let mut p = parse::new_parser_from_tts(cx.parse_sess(),
@@ -473,7 +471,7 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
473471
cx.span_err(sp, "expected token: `,`");
474472
return None;
475473
}
476-
es.push(cx.expand_expr(p.parse_expr()));
474+
es.push(p.parse_expr());
477475
}
478476
Some(es)
479477
}
@@ -484,6 +482,9 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
484482

485483
// This environment maps Names to SyntaxExtensions.
486484

485+
// Actually, the following implementation is parameterized
486+
// by both key and value types.
487+
487488
//impl question: how to implement it? Initially, the
488489
// env will contain only macros, so it might be painful
489490
// to add an empty frame for every context. Let's just
@@ -499,6 +500,14 @@ struct MapChainFrame {
499500
map: HashMap<Name, SyntaxExtension>,
500501
}
501502

503+
#[unsafe_destructor]
504+
impl Drop for MapChainFrame {
505+
fn drop(&mut self) {
506+
// make sure that syntax extension dtors run before we drop the libs
507+
self.map.clear();
508+
}
509+
}
510+
502511
// Only generic to make it easy to test
503512
pub struct SyntaxEnv {
504513
priv chain: Vec<MapChainFrame> ,

trunk/src/libsyntax/ext/concat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
2525
};
2626
let mut accumulator = ~"";
2727
for e in es.move_iter() {
28+
let e = cx.expand_expr(e);
2829
match e.node {
2930
ast::ExprLit(lit) => {
3031
match lit.node {

trunk/src/libsyntax/ext/format.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,11 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
843843
fmtsp: sp,
844844
};
845845
cx.fmtsp = efmt.span;
846+
// Be sure to recursively expand macros just in case the format string uses
847+
// a macro to build the format expression.
848+
let expr = cx.ecx.expand_expr(efmt);
846849
let fmt = match expr_to_str(cx.ecx,
847-
efmt,
850+
expr,
848851
"format argument must be a string literal.") {
849852
Some((fmt, _)) => fmt,
850853
None => return MacResult::raw_dummy_expr(sp)

trunk/src/libterm/terminfo/searcher.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~Path> {
4242
dirs_to_search.push(Path::new(i.to_owned()));
4343
}
4444
},
45-
// Found nothing in TERMINFO_DIRS, use the default paths:
46-
// According to /etc/terminfo/README, after looking at
47-
// ~/.terminfo, ncurses will search /etc/terminfo, then
48-
// /lib/terminfo, and eventually /usr/share/terminfo.
45+
// Found nothing, use the default paths
46+
// /usr/share/terminfo is the de facto location, but it seems
47+
// Ubuntu puts it in /lib/terminfo
4948
None => {
50-
dirs_to_search.push(Path::new("/etc/terminfo"));
51-
dirs_to_search.push(Path::new("/lib/terminfo"));
5249
dirs_to_search.push(Path::new("/usr/share/terminfo"));
50+
dirs_to_search.push(Path::new("/lib/terminfo"));
5351
}
5452
}
5553
}

trunk/src/test/compile-fail/macro-crate-unexported-macro.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// aux-build:macro_crate_test.rs
1212
// ignore-stage1
1313
// ignore-android
14+
// ignore-cross-compile #12102
1415

1516
#[feature(phase)];
1617

trunk/src/test/compile-fail/phase-syntax-doesnt-resolve.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// aux-build:macro_crate_test.rs
1212
// ignore-stage1
1313
// ignore-android
14+
// ignore-cross-compile #12102
1415

1516
#[feature(phase)];
1617

trunk/src/test/run-pass/asm-concat-src.rs

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

trunk/src/test/run-pass/asm-out-assign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

trunk/src/test/run-pass/ext-expand-inner-exprs.rs

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

0 commit comments

Comments
 (0)