Skip to content

Commit 99a7ecf

Browse files
committed
---
yaml --- r: 152231 b: refs/heads/try2 c: 1ec6de3 h: refs/heads/master i: 152229: 9880da4 152227: 48ae73a 152223: 72ce0db v: v3
1 parent dc0d589 commit 99a7ecf

File tree

6 files changed

+59
-140
lines changed

6 files changed

+59
-140
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: 8d8a291e1cd9de0fa889c240fc1aa2694f5f11de
8+
refs/heads/try2: 1ec6de3ecf55e86b77b27c3384a91dfdac797f00
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/README.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,26 @@ Source layout:
55
| Path | Description |
66
| ------------------- | --------------------------------------------------------- |
77
| `librustc/` | The self-hosted compiler |
8-
| `liballoc/` | Rust's core allocation library |
9-
| `libcore/` | The Rust core library |
10-
| `libdebug/` | Debugging utilities |
118
| `libstd/` | The standard library (imported and linked by default) |
9+
| `libextra/` | The "extras" library (slightly more peripheral code) |
1210
| `libgreen/` | The M:N runtime library |
1311
| `libnative/` | The 1:1 runtime library |
1412
| `libsyntax/` | The Rust parser and pretty-printer |
13+
| `libcollections/` | A collection of useful data structures and containers |
14+
| `libnum/` | Extended number support library (complex, rational, etc) |
1515
| `libtest/` | Rust's test-runner code |
1616
| ------------------- | --------------------------------------------------------- |
1717
| `libarena/` | The arena (a fast but limited) memory allocator |
18-
| `libbacktrace/` | The libbacktrace library |
19-
| `libcollections/` | A collection of useful data structures and containers |
2018
| `libflate/` | Simple compression library |
21-
| `libfmt_macros/` | Macro support for format strings |
2219
| `libfourcc/` | Data format identifier library |
2320
| `libgetopts/` | Get command-line-options library |
2421
| `libglob/` | Unix glob patterns library |
25-
| `libgraphviz/` | Generating files for Graphviz |
26-
| `libhexfloat/` | Hexadecimal floating-point literals |
27-
| `liblibc/` | Bindings for the C standard library |
28-
| `liblog/` | Utilities for program-wide and customizable logging |
29-
| `libnum/` | Extended number support library (complex, rational, etc) |
30-
| `librand/` | Random numbers and distributions |
3122
| `libregex/` | Regular expressions |
32-
| `libregex_macros/` | The regex! syntax extension |
3323
| `libsemver/` | Rust's semantic versioning library |
3424
| `libserialize/` | Encode-Decode types library |
3525
| `libsync/` | Concurrency mechanisms and primitives |
3626
| `libterm/` | ANSI color library for terminals |
3727
| `libtime/` | Time operations library |
38-
| `liburl/` | URL handling lirary |
3928
| `libuuid/` | UUID's handling code |
4029
| ------------------- | --------------------------------------------------------- |
4130
| `rt/` | The runtime system |

branches/try2/src/doc/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and its implications on a task that programmers usually find very difficult: con
1818

1919
Ownership is central to Rust,
2020
and is the feature from which many of Rust's powerful capabilities are derived.
21-
"Ownership" refers to which parts of your code are allowed to read,
21+
"Ownership" refers to which parts of your code are allowed read,
2222
write, and ultimately release, memory.
2323
Let's start by looking at some C++ code:
2424

branches/try2/src/libregex_macros/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
html_root_url = "http://doc.rust-lang.org/")]
2121

2222
#![feature(macro_registrar, managed_boxes, quote)]
23-
#![allow(unused_imports)] // `quote_expr!` adds some `use` globs which may be unused
2423

2524
extern crate regex;
2625
extern crate syntax;

branches/try2/src/libserialize/json.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,10 +2227,6 @@ impl<A:ToJson,B:ToJson,C:ToJson> ToJson for (A, B, C) {
22272227
}
22282228
}
22292229

2230-
impl<'a, A:ToJson> ToJson for &'a [A] {
2231-
fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
2232-
}
2233-
22342230
impl<A:ToJson> ToJson for ~[A] {
22352231
fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
22362232
}
@@ -3338,56 +3334,6 @@ mod tests {
33383334
assert!(stack.get(1) == Key("foo"));
33393335
}
33403336

3341-
#[test]
3342-
fn test_to_json() {
3343-
use collections::{HashMap,TreeMap};
3344-
use super::ToJson;
3345-
3346-
let list2 = List(vec!(Number(1.0_f64), Number(2.0_f64)));
3347-
let list3 = List(vec!(Number(1.0f64), Number(2.0f64), Number(3.0f64)));
3348-
let object = {
3349-
let mut tree_map = TreeMap::new();
3350-
tree_map.insert("a".to_string(), Number(1.0_f64));
3351-
tree_map.insert("b".to_string(), Number(2.0_f64));
3352-
Object(box tree_map)
3353-
};
3354-
3355-
assert_eq!(list2.to_json(), list2);
3356-
assert_eq!(object.to_json(), object);
3357-
assert_eq!(3_i.to_json(), Number(3.0_f64));
3358-
assert_eq!(4_i8.to_json(), Number(4.0_f64));
3359-
assert_eq!(5_i16.to_json(), Number(5.0_f64));
3360-
assert_eq!(6_i32.to_json(), Number(6.0_f64));
3361-
assert_eq!(7_i64.to_json(), Number(7.0_f64));
3362-
assert_eq!(8_u.to_json(), Number(8.0_f64));
3363-
assert_eq!(9_u8.to_json(), Number(9.0_f64));
3364-
assert_eq!(10_u16.to_json(), Number(10.0_f64));
3365-
assert_eq!(11_u32.to_json(), Number(11.0_f64));
3366-
assert_eq!(12_u64.to_json(), Number(12.0_f64));
3367-
assert_eq!(13.0_f32.to_json(), Number(13.0_f64));
3368-
assert_eq!(14.0_f64.to_json(), Number(14.0_f64));
3369-
assert_eq!(().to_json(), Null);
3370-
assert_eq!(true.to_json(), Boolean(true));
3371-
assert_eq!(false.to_json(), Boolean(false));
3372-
assert_eq!("abc".to_string().to_json(), String("abc".to_string()));
3373-
assert_eq!((1, 2).to_json(), list2);
3374-
assert_eq!((1, 2, 3).to_json(), list3);
3375-
assert_eq!([1, 2].to_json(), list2);
3376-
assert_eq!((&[1, 2, 3]).to_json(), list3);
3377-
assert_eq!((~[1, 2]).to_json(), list2);
3378-
assert_eq!(vec!(1, 2, 3).to_json(), list3);
3379-
let mut tree_map = TreeMap::new();
3380-
tree_map.insert("a".to_string(), 1);
3381-
tree_map.insert("b".to_string(), 2);
3382-
assert_eq!(tree_map.to_json(), object);
3383-
let mut hash_map = HashMap::new();
3384-
hash_map.insert("a".to_string(), 1);
3385-
hash_map.insert("b".to_string(), 2);
3386-
assert_eq!(hash_map.to_json(), object);
3387-
assert_eq!(Some(15).to_json(), Number(15 as f64));
3388-
assert_eq!(None::<int>.to_json(), Null);
3389-
}
3390-
33913337
#[bench]
33923338
fn bench_streaming_small(b: &mut Bencher) {
33933339
b.iter( || {

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

Lines changed: 54 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,16 @@ fn mk_ident(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::Expr {
401401
vec!(e_str))
402402
}
403403

404+
fn mk_ast_path(cx: &ExtCtxt, sp: Span, name: &str) -> @ast::Expr {
405+
let idents = vec!(id_ext("syntax"), id_ext("ast"), id_ext(name));
406+
cx.expr_path(cx.path_global(sp, idents))
407+
}
408+
409+
fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> @ast::Expr {
410+
let idents = vec!(id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name));
411+
cx.expr_path(cx.path_global(sp, idents))
412+
}
413+
404414
fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOp) -> @ast::Expr {
405415
let name = match bop {
406416
PLUS => "PLUS",
@@ -414,116 +424,96 @@ fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOp) -> @ast::Expr {
414424
SHL => "SHL",
415425
SHR => "SHR"
416426
};
417-
cx.expr_ident(sp, id_ext(name))
427+
mk_token_path(cx, sp, name)
418428
}
419429

420430
fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
421431

422432
match *tok {
423433
BINOP(binop) => {
424-
return cx.expr_call_ident(sp,
425-
id_ext("BINOP"),
426-
vec!(mk_binop(cx, sp, binop)));
434+
return cx.expr_call(sp, mk_token_path(cx, sp, "BINOP"), vec!(mk_binop(cx, sp, binop)));
427435
}
428436
BINOPEQ(binop) => {
429-
return cx.expr_call_ident(sp,
430-
id_ext("BINOPEQ"),
431-
vec!(mk_binop(cx, sp, binop)));
437+
return cx.expr_call(sp, mk_token_path(cx, sp, "BINOPEQ"),
438+
vec!(mk_binop(cx, sp, binop)));
432439
}
433440

434441
LIT_CHAR(i) => {
435442
let e_char = cx.expr_lit(sp, ast::LitChar(i));
436443

437-
return cx.expr_call_ident(sp, id_ext("LIT_CHAR"), vec!(e_char));
444+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_CHAR"), vec!(e_char));
438445
}
439446

440447
LIT_INT(i, ity) => {
441448
let s_ity = match ity {
442-
ast::TyI => "TyI".to_string(),
443-
ast::TyI8 => "TyI8".to_string(),
444-
ast::TyI16 => "TyI16".to_string(),
445-
ast::TyI32 => "TyI32".to_string(),
446-
ast::TyI64 => "TyI64".to_string()
449+
ast::TyI => "TyI",
450+
ast::TyI8 => "TyI8",
451+
ast::TyI16 => "TyI16",
452+
ast::TyI32 => "TyI32",
453+
ast::TyI64 => "TyI64"
447454
};
448-
let e_ity = cx.expr_ident(sp, id_ext(s_ity.as_slice()));
449-
455+
let e_ity = mk_ast_path(cx, sp, s_ity);
450456
let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
451-
452-
return cx.expr_call_ident(sp,
453-
id_ext("LIT_INT"),
454-
vec!(e_i64, e_ity));
457+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INT"), vec!(e_i64, e_ity));
455458
}
456459

457460
LIT_UINT(u, uty) => {
458461
let s_uty = match uty {
459-
ast::TyU => "TyU".to_string(),
460-
ast::TyU8 => "TyU8".to_string(),
461-
ast::TyU16 => "TyU16".to_string(),
462-
ast::TyU32 => "TyU32".to_string(),
463-
ast::TyU64 => "TyU64".to_string()
462+
ast::TyU => "TyU",
463+
ast::TyU8 => "TyU8",
464+
ast::TyU16 => "TyU16",
465+
ast::TyU32 => "TyU32",
466+
ast::TyU64 => "TyU64"
464467
};
465-
let e_uty = cx.expr_ident(sp, id_ext(s_uty.as_slice()));
466-
468+
let e_uty = mk_ast_path(cx, sp, s_uty);
467469
let e_u64 = cx.expr_lit(sp, ast::LitUint(u, ast::TyU64));
468-
469-
return cx.expr_call_ident(sp,
470-
id_ext("LIT_UINT"),
471-
vec!(e_u64, e_uty));
470+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_UINT"), vec!(e_u64, e_uty));
472471
}
473472

474473
LIT_INT_UNSUFFIXED(i) => {
475474
let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
476-
477-
return cx.expr_call_ident(sp,
478-
id_ext("LIT_INT_UNSUFFIXED"),
479-
vec!(e_i64));
475+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INT_UNSUFFIXED"), vec!(e_i64));
480476
}
481477

482478
LIT_FLOAT(fident, fty) => {
483479
let s_fty = match fty {
484-
ast::TyF32 => "TyF32".to_string(),
485-
ast::TyF64 => "TyF64".to_string(),
486-
ast::TyF128 => "TyF128".to_string()
480+
ast::TyF32 => "TyF32",
481+
ast::TyF64 => "TyF64",
482+
ast::TyF128 => "TyF128"
487483
};
488-
let e_fty = cx.expr_ident(sp, id_ext(s_fty.as_slice()));
489-
484+
let e_fty = mk_ast_path(cx, sp, s_fty);
490485
let e_fident = mk_ident(cx, sp, fident);
491-
492-
return cx.expr_call_ident(sp,
493-
id_ext("LIT_FLOAT"),
494-
vec!(e_fident, e_fty));
486+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_FLOAT"), vec!(e_fident, e_fty));
495487
}
496488

497489
LIT_STR(ident) => {
498-
return cx.expr_call_ident(sp,
499-
id_ext("LIT_STR"),
500-
vec!(mk_ident(cx, sp, ident)));
490+
return cx.expr_call(sp,
491+
mk_token_path(cx, sp, "LIT_STR"),
492+
vec!(mk_ident(cx, sp, ident)));
501493
}
502494

503495
LIT_STR_RAW(ident, n) => {
504-
return cx.expr_call_ident(sp,
505-
id_ext("LIT_STR_RAW"),
506-
vec!(mk_ident(cx, sp, ident),
507-
cx.expr_uint(sp, n)));
496+
return cx.expr_call(sp,
497+
mk_token_path(cx, sp, "LIT_STR_RAW"),
498+
vec!(mk_ident(cx, sp, ident), cx.expr_uint(sp, n)));
508499
}
509500

510501
IDENT(ident, b) => {
511-
return cx.expr_call_ident(sp,
512-
id_ext("IDENT"),
513-
vec!(mk_ident(cx, sp, ident),
514-
cx.expr_bool(sp, b)));
502+
return cx.expr_call(sp,
503+
mk_token_path(cx, sp, "IDENT"),
504+
vec!(mk_ident(cx, sp, ident), cx.expr_bool(sp, b)));
515505
}
516506

517507
LIFETIME(ident) => {
518-
return cx.expr_call_ident(sp,
519-
id_ext("LIFETIME"),
520-
vec!(mk_ident(cx, sp, ident)));
508+
return cx.expr_call(sp,
509+
mk_token_path(cx, sp, "LIFETIME"),
510+
vec!(mk_ident(cx, sp, ident)));
521511
}
522512

523513
DOC_COMMENT(ident) => {
524-
return cx.expr_call_ident(sp,
525-
id_ext("DOC_COMMENT"),
526-
vec!(mk_ident(cx, sp, ident)));
514+
return cx.expr_call(sp,
515+
mk_token_path(cx, sp, "DOC_COMMENT"),
516+
vec!(mk_ident(cx, sp, ident)));
527517
}
528518

529519
INTERPOLATED(_) => fail!("quote! with interpolated token"),
@@ -565,19 +555,16 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
565555
EOF => "EOF",
566556
_ => fail!()
567557
};
568-
cx.expr_ident(sp, id_ext(name))
558+
mk_token_path(cx, sp, name)
569559
}
570560

571-
572561
fn mk_tt(cx: &ExtCtxt, sp: Span, tt: &ast::TokenTree) -> Vec<@ast::Stmt> {
573-
574562
match *tt {
575-
576563
ast::TTTok(sp, ref tok) => {
577564
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
578-
let e_tok = cx.expr_call_ident(sp,
579-
id_ext("TTTok"),
580-
vec!(e_sp, mk_token(cx, sp, tok)));
565+
let e_tok = cx.expr_call(sp,
566+
mk_ast_path(cx, sp, "TTTok"),
567+
vec!(e_sp, mk_token(cx, sp, tok)));
581568
let e_push =
582569
cx.expr_method_call(sp,
583570
cx.expr_ident(sp, id_ext("tt")),
@@ -695,8 +682,6 @@ fn expand_wrapper(cx: &ExtCtxt,
695682
cx_expr: @ast::Expr,
696683
expr: @ast::Expr) -> @ast::Expr {
697684
let uses = [
698-
&["syntax", "ast"],
699-
&["syntax", "parse", "token"],
700685
&["syntax", "ext", "quote", "rt"],
701686
].iter().map(|path| {
702687
let path = path.iter().map(|s| s.to_string()).collect();

0 commit comments

Comments
 (0)