Skip to content

Commit cbb2848

Browse files
committed
---
yaml --- r: 108790 b: refs/heads/dist-snap c: 4eea6f7 h: refs/heads/master v: v3
1 parent f882f08 commit cbb2848

File tree

9 files changed

+48
-28
lines changed

9 files changed

+48
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 6a6d933af3862d650498b19d1b18caae98966edb
9+
refs/heads/dist-snap: 4eea6f7f244958374d3546b0c018f609de12d21d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libsyntax/ext/base.rs

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

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)
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)
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);
413415
match expr.node {
414416
ast::ExprLit(l) => match l.node {
415417
ast::LitStr(ref s, style) => return Some(((*s).clone(), style)),
@@ -457,7 +459,7 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
457459

458460
/// Extract comma-separated expressions from `tts`. If there is a
459461
/// parsing error, emit a non-fatal error and return None.
460-
pub fn get_exprs_from_tts(cx: &ExtCtxt,
462+
pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
461463
sp: Span,
462464
tts: &[ast::TokenTree]) -> Option<Vec<@ast::Expr> > {
463465
let mut p = parse::new_parser_from_tts(cx.parse_sess(),
@@ -471,7 +473,7 @@ pub fn get_exprs_from_tts(cx: &ExtCtxt,
471473
cx.span_err(sp, "expected token: `,`");
472474
return None;
473475
}
474-
es.push(p.parse_expr());
476+
es.push(cx.expand_expr(p.parse_expr()));
475477
}
476478
Some(es)
477479
}
@@ -482,9 +484,6 @@ pub fn get_exprs_from_tts(cx: &ExtCtxt,
482484

483485
// This environment maps Names to SyntaxExtensions.
484486

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

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-
511502
// Only generic to make it easy to test
512503
pub struct SyntaxEnv {
513504
priv chain: Vec<MapChainFrame> ,

branches/dist-snap/src/libsyntax/ext/concat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ 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);
2928
match e.node {
3029
ast::ExprLit(lit) => {
3130
match lit.node {

branches/dist-snap/src/libsyntax/ext/format.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,11 +843,8 @@ 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);
849846
let fmt = match expr_to_str(cx.ecx,
850-
expr,
847+
efmt,
851848
"format argument must be a string literal.") {
852849
Some((fmt, _)) => fmt,
853850
None => return MacResult::raw_dummy_expr(sp)

branches/dist-snap/src/libterm/terminfo/searcher.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ 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, use the default paths
46-
// /usr/share/terminfo is the de facto location, but it seems
47-
// Ubuntu puts it in /lib/terminfo
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.
4849
None => {
49-
dirs_to_search.push(Path::new("/usr/share/terminfo"));
50+
dirs_to_search.push(Path::new("/etc/terminfo"));
5051
dirs_to_search.push(Path::new("/lib/terminfo"));
52+
dirs_to_search.push(Path::new("/usr/share/terminfo"));
5153
}
5254
}
5355
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2014 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+
// ignore-fast #[feature] doesn't work with check-fast
12+
#[feature(asm)];
13+
14+
pub fn main() {
15+
unsafe { asm!(concat!("", "")) };
16+
}

branches/dist-snap/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-2013-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-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
//
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 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+
static FOO : &'static [u8] = bytes!(concat!(concat!("hel", "lo"), "world"));
12+
13+
pub fn main() {
14+
assert_eq!(FOO, "helloworld".as_bytes());
15+
}

0 commit comments

Comments
 (0)