Skip to content

Commit 1b802dc

Browse files
committed
---
yaml --- r: 152235 b: refs/heads/try2 c: 559ff5e h: refs/heads/master i: 152233: 17bbcd5 152231: 99a7ecf v: v3
1 parent fd00bd1 commit 1b802dc

File tree

5 files changed

+75
-79
lines changed

5 files changed

+75
-79
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: f5ead0dd66ab7c3aaaaabcc34e1726a4acd74b07
8+
refs/heads/try2: 559ff5e64b16023523c208539f98c35bb5cdb325
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libregex_macros/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
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
2324

2425
extern crate regex;
2526
extern crate syntax;

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,6 @@ pub struct Inherited<'a> {
168168
upvar_borrow_map: RefCell<ty::UpvarBorrowMap>,
169169
}
170170

171-
#[deriving(Clone)]
172-
pub enum FnKind {
173-
// A do-closure.
174-
DoBlock,
175-
176-
// A normal closure or fn item.
177-
Vanilla
178-
}
179-
180171
#[deriving(Clone)]
181172
pub struct FnStyleState {
182173
pub def: ast::NodeId,
@@ -249,11 +240,6 @@ pub struct FnCtxt<'a> {
249240
// can actually be made to live as long as it needs to live.
250241
region_lb: Cell<ast::NodeId>,
251242

252-
// Says whether we're inside a for loop, in a do block
253-
// or neither. Helps with error messages involving the
254-
// function return type.
255-
fn_kind: FnKind,
256-
257243
inh: &'a Inherited<'a>,
258244

259245
ccx: &'a CrateCtxt<'a>,
@@ -289,7 +275,6 @@ fn blank_fn_ctxt<'a>(ccx: &'a CrateCtxt<'a>,
289275
ret_ty: rty,
290276
ps: RefCell::new(FnStyleState::function(ast::NormalFn, 0)),
291277
region_lb: Cell::new(region_bnd),
292-
fn_kind: Vanilla,
293278
inh: inh,
294279
ccx: ccx
295280
}
@@ -356,7 +341,7 @@ fn check_bare_fn(ccx: &CrateCtxt,
356341
ty::ty_bare_fn(ref fn_ty) => {
357342
let inh = Inherited::new(ccx.tcx, param_env);
358343
let fcx = check_fn(ccx, fn_ty.fn_style, &fn_ty.sig,
359-
decl, id, body, Vanilla, &inh);
344+
decl, id, body, &inh);
360345

361346
vtable::resolve_in_block(&fcx, body);
362347
regionck::regionck_fn(&fcx, body);
@@ -440,7 +425,6 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
440425
decl: &ast::FnDecl,
441426
id: ast::NodeId,
442427
body: &ast::Block,
443-
fn_kind: FnKind,
444428
inherited: &'a Inherited<'a>) -> FnCtxt<'a>
445429
{
446430
/*!
@@ -479,7 +463,6 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>,
479463
ret_ty: ret_ty,
480464
ps: RefCell::new(FnStyleState::function(fn_style, id)),
481465
region_lb: Cell::new(body.id),
482-
fn_kind: fn_kind,
483466
inh: inherited,
484467
ccx: ccx
485468
};
@@ -2295,7 +2278,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
22952278
store: ty::TraitStore,
22962279
decl: &ast::FnDecl,
22972280
body: ast::P<ast::Block>,
2298-
fn_kind: FnKind,
22992281
expected: Option<ty::t>) {
23002282
let tcx = fcx.ccx.tcx;
23012283

@@ -2373,7 +2355,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
23732355
};
23742356

23752357
check_fn(fcx.ccx, inherited_style, &fty_sig,
2376-
decl, id, body, fn_kind, fcx.inh);
2358+
decl, id, body, fcx.inh);
23772359
}
23782360

23792361

@@ -3044,7 +3026,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
30443026
ty::RegionTraitStore(region, ast::MutMutable),
30453027
decl,
30463028
body,
3047-
Vanilla,
30483029
expected);
30493030
}
30503031
ast::ExprProc(decl, body) => {
@@ -3053,7 +3034,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
30533034
ty::UniqTraitStore,
30543035
decl,
30553036
body,
3056-
Vanilla,
30573037
expected);
30583038
}
30593039
ast::ExprBlock(b) => {

branches/try2/src/libsyntax/crateid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013 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
//
@@ -13,7 +13,7 @@ use std::fmt;
1313
/// CrateIds identify crates and include the crate name and optionally a path
1414
/// and version. In the full form, they look like relative URLs. Example:
1515
/// `github.com/mozilla/rust#std:1.0` would be a package ID with a path of
16-
/// `github.com/mozilla/rust` and a crate name of `std` with a version of
16+
/// `gitub.com/mozilla/rust` and a crate name of `std` with a version of
1717
/// `1.0`. If no crate name is given after the hash, the name is inferred to
1818
/// be the last component of the path. If no version is given, it is inferred
1919
/// to be `0.0`.

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

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,6 @@ 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-
414404
fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOp) -> @ast::Expr {
415405
let name = match bop {
416406
PLUS => "PLUS",
@@ -424,96 +414,116 @@ fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOp) -> @ast::Expr {
424414
SHL => "SHL",
425415
SHR => "SHR"
426416
};
427-
mk_token_path(cx, sp, name)
417+
cx.expr_ident(sp, id_ext(name))
428418
}
429419

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

432422
match *tok {
433423
BINOP(binop) => {
434-
return cx.expr_call(sp, mk_token_path(cx, sp, "BINOP"), vec!(mk_binop(cx, sp, binop)));
424+
return cx.expr_call_ident(sp,
425+
id_ext("BINOP"),
426+
vec!(mk_binop(cx, sp, binop)));
435427
}
436428
BINOPEQ(binop) => {
437-
return cx.expr_call(sp, mk_token_path(cx, sp, "BINOPEQ"),
438-
vec!(mk_binop(cx, sp, binop)));
429+
return cx.expr_call_ident(sp,
430+
id_ext("BINOPEQ"),
431+
vec!(mk_binop(cx, sp, binop)));
439432
}
440433

441434
LIT_CHAR(i) => {
442435
let e_char = cx.expr_lit(sp, ast::LitChar(i));
443436

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

447440
LIT_INT(i, ity) => {
448441
let s_ity = match ity {
449-
ast::TyI => "TyI",
450-
ast::TyI8 => "TyI8",
451-
ast::TyI16 => "TyI16",
452-
ast::TyI32 => "TyI32",
453-
ast::TyI64 => "TyI64"
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()
454447
};
455-
let e_ity = mk_ast_path(cx, sp, s_ity);
448+
let e_ity = cx.expr_ident(sp, id_ext(s_ity.as_slice()));
449+
456450
let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
457-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INT"), vec!(e_i64, e_ity));
451+
452+
return cx.expr_call_ident(sp,
453+
id_ext("LIT_INT"),
454+
vec!(e_i64, e_ity));
458455
}
459456

460457
LIT_UINT(u, uty) => {
461458
let s_uty = match uty {
462-
ast::TyU => "TyU",
463-
ast::TyU8 => "TyU8",
464-
ast::TyU16 => "TyU16",
465-
ast::TyU32 => "TyU32",
466-
ast::TyU64 => "TyU64"
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()
467464
};
468-
let e_uty = mk_ast_path(cx, sp, s_uty);
465+
let e_uty = cx.expr_ident(sp, id_ext(s_uty.as_slice()));
466+
469467
let e_u64 = cx.expr_lit(sp, ast::LitUint(u, ast::TyU64));
470-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_UINT"), vec!(e_u64, e_uty));
468+
469+
return cx.expr_call_ident(sp,
470+
id_ext("LIT_UINT"),
471+
vec!(e_u64, e_uty));
471472
}
472473

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

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

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

495503
LIT_STR_RAW(ident, 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)));
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)));
499508
}
500509

501510
IDENT(ident, 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)));
511+
return cx.expr_call_ident(sp,
512+
id_ext("IDENT"),
513+
vec!(mk_ident(cx, sp, ident),
514+
cx.expr_bool(sp, b)));
505515
}
506516

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

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

519529
INTERPOLATED(_) => fail!("quote! with interpolated token"),
@@ -555,16 +565,19 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
555565
EOF => "EOF",
556566
_ => fail!()
557567
};
558-
mk_token_path(cx, sp, name)
568+
cx.expr_ident(sp, id_ext(name))
559569
}
560570

571+
561572
fn mk_tt(cx: &ExtCtxt, sp: Span, tt: &ast::TokenTree) -> Vec<@ast::Stmt> {
573+
562574
match *tt {
575+
563576
ast::TTTok(sp, ref tok) => {
564577
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
565-
let e_tok = cx.expr_call(sp,
566-
mk_ast_path(cx, sp, "TTTok"),
567-
vec!(e_sp, mk_token(cx, sp, tok)));
578+
let e_tok = cx.expr_call_ident(sp,
579+
id_ext("TTTok"),
580+
vec!(e_sp, mk_token(cx, sp, tok)));
568581
let e_push =
569582
cx.expr_method_call(sp,
570583
cx.expr_ident(sp, id_ext("tt")),
@@ -682,6 +695,8 @@ fn expand_wrapper(cx: &ExtCtxt,
682695
cx_expr: @ast::Expr,
683696
expr: @ast::Expr) -> @ast::Expr {
684697
let uses = [
698+
&["syntax", "ast"],
699+
&["syntax", "parse", "token"],
685700
&["syntax", "ext", "quote", "rt"],
686701
].iter().map(|path| {
687702
let path = path.iter().map(|s| s.to_string()).collect();

0 commit comments

Comments
 (0)