Skip to content

Commit 9fb10a0

Browse files
Rymanalexcrichton
authored andcommitted
---
yaml --- r: 152563 b: refs/heads/try2 c: 9945052 h: refs/heads/master i: 152561: 4e8bf88 152559: 48b717d v: v3
1 parent 291da3e commit 9fb10a0

File tree

16 files changed

+44
-26
lines changed

16 files changed

+44
-26
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: 051abae802318d8401c9b5e6baa9ffc863f7f8eb
8+
refs/heads/try2: 9945052e64737a21a7d9a6cb337bda1a4eed3e0a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/back/svh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ mod svh_visitor {
270270
ExprBlock(..) => SawExprBlock,
271271
ExprAssign(..) => SawExprAssign,
272272
ExprAssignOp(op, _, _) => SawExprAssignOp(op),
273-
ExprField(_, id, _) => SawExprField(content(id)),
273+
ExprField(_, id, _) => SawExprField(content(id.node)),
274274
ExprIndex(..) => SawExprIndex,
275275
ExprPath(..) => SawExprPath,
276276
ExprAddrOf(m, _) => SawExprAddrOf(m),

branches/try2/src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl<'a> Visitor<MarkSymbolVisitorContext> for MarkSymbolVisitor<'a> {
235235
self.lookup_and_handle_method(expr.id, expr.span);
236236
}
237237
ast::ExprField(ref lhs, ref ident, _) => {
238-
self.handle_field_access(&**lhs, ident);
238+
self.handle_field_access(&**lhs, &ident.node);
239239
}
240240
_ => ()
241241
}

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> {
447447

448448
ast::ExprField(ref base, f_name, _) => {
449449
let base_cmt = if_ok!(self.cat_expr(&**base));
450-
Ok(self.cat_field(expr, base_cmt, f_name, expr_ty))
450+
Ok(self.cat_field(expr, base_cmt, f_name.node, expr_ty))
451451
}
452452

453453
ast::ExprIndex(ref base, _) => {

branches/try2/src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
801801
ast::ExprField(ref base, ident, _) => {
802802
match ty::get(ty::expr_ty_adjusted(self.tcx, &**base)).sty {
803803
ty::ty_struct(id, _) => {
804-
self.check_field(expr.span, id, NamedField(ident));
804+
self.check_field(expr.span, id, NamedField(ident.node));
805805
}
806806
_ => {}
807807
}

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5241,7 +5241,7 @@ impl<'a> Resolver<'a> {
52415241
// field, we need to add any trait methods we find that match
52425242
// the field name so that we can do some nice error reporting
52435243
// later on in typeck.
5244-
let traits = self.search_for_traits_containing_method(ident.name);
5244+
let traits = self.search_for_traits_containing_method(ident.node.name);
52455245
self.trait_map.insert(expr.id, traits);
52465246
}
52475247
ExprMethodCall(ident, _, _) => {

branches/try2/src/librustc/middle/save/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ impl<'l> Visitor<DxrVisitorEnv> for DxrVisitor<'l> {
12101210
ty::ty_struct(def_id, _) => {
12111211
let fields = ty::lookup_struct_fields(&self.analysis.ty_cx, def_id);
12121212
for f in fields.iter() {
1213-
if f.name == ident.name {
1213+
if f.name == ident.node.name {
12141214
let sub_span = self.span.span_for_last_ident(ex.span);
12151215
self.fmt.ref_str(recorder::VarRef,
12161216
ex.span,

branches/try2/src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
419419
let brepr = adt::represent_type(cx, bt);
420420
let (bv, inlineable) = const_expr(cx, &**base, is_local);
421421
expr::with_field_tys(cx.tcx(), bt, None, |discr, field_tys| {
422-
let ix = ty::field_idx_strict(cx.tcx(), field.name, field_tys);
422+
let ix = ty::field_idx_strict(cx.tcx(), field.node.name, field_tys);
423423
(adt::const_get_field(cx, &*brepr, bv, discr, ix), inlineable)
424424
})
425425
}

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn trans_datum_unadjusted<'a>(bcx: &'a Block<'a>,
389389
trans_def(bcx, expr, bcx.def(expr.id))
390390
}
391391
ast::ExprField(ref base, ident, _) => {
392-
trans_rec_field(bcx, &**base, ident)
392+
trans_rec_field(bcx, &**base, ident.node)
393393
}
394394
ast::ExprIndex(ref base, ref idx) => {
395395
trans_index(bcx, expr, &**base, &**idx)

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
23522352
expr: &ast::Expr,
23532353
lvalue_pref: LvaluePreference,
23542354
base: &ast::Expr,
2355-
field: ast::Name,
2355+
field: &ast::SpannedIdent,
23562356
tys: &[ast::P<ast::Ty>]) {
23572357
let tcx = fcx.ccx.tcx;
23582358
check_expr_with_lvalue_pref(fcx, base, lvalue_pref);
@@ -2365,7 +2365,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
23652365
ty::ty_struct(base_id, ref substs) => {
23662366
debug!("struct named {}", ppaux::ty_to_str(tcx, base_t));
23672367
let fields = ty::lookup_struct_fields(tcx, base_id);
2368-
lookup_field_ty(tcx, base_id, fields.as_slice(), field, &(*substs))
2368+
lookup_field_ty(tcx, base_id, fields.as_slice(), field.node.name, &(*substs))
23692369
}
23702370
_ => None
23712371
}
@@ -2383,7 +2383,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
23832383
match method::lookup(fcx,
23842384
expr,
23852385
base,
2386-
field,
2386+
field.node.name,
23872387
expr_t,
23882388
tps.as_slice(),
23892389
DontDerefArgs,
@@ -2392,14 +2392,14 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
23922392
IgnoreStaticMethods) {
23932393
Some(_) => {
23942394
fcx.type_error_message(
2395-
expr.span,
2395+
field.span,
23962396
|actual| {
23972397
format!("attempted to take value of method `{}` on type \
2398-
`{}`", token::get_name(field), actual)
2398+
`{}`", token::get_ident(field.node), actual)
23992399
},
24002400
expr_t, None);
24012401

2402-
tcx.sess.span_note(expr.span,
2402+
tcx.sess.span_note(field.span,
24032403
"maybe a missing `()` to call it? If not, try an anonymous function.");
24042404
}
24052405

@@ -2410,7 +2410,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
24102410
format!("attempted access of field `{}` on \
24112411
type `{}`, but no field with that \
24122412
name was found",
2413-
token::get_name(field),
2413+
token::get_ident(field.node),
24142414
actual)
24152415
},
24162416
expr_t, None);
@@ -3214,7 +3214,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
32143214
}
32153215
}
32163216
ast::ExprField(ref base, ref field, ref tys) => {
3217-
check_field(fcx, expr, lvalue_pref, &**base, field.name, tys.as_slice());
3217+
check_field(fcx, expr, lvalue_pref, &**base, field, tys.as_slice());
32183218
}
32193219
ast::ExprIndex(ref base, ref idx) => {
32203220
check_expr_with_lvalue_pref(fcx, &**base, lvalue_pref);

branches/try2/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ pub enum Expr_ {
464464

465465
ExprAssign(Gc<Expr>, Gc<Expr>),
466466
ExprAssignOp(BinOp, Gc<Expr>, Gc<Expr>),
467-
ExprField(Gc<Expr>, Ident, Vec<P<Ty>>),
467+
ExprField(Gc<Expr>, SpannedIdent, Vec<P<Ty>>),
468468
ExprIndex(Gc<Expr>, Gc<Expr>),
469469

470470
/// Expression that looks like a "name". For example,

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use ast::{P, Ident, Generics, NodeId, Expr};
1313
use ast;
1414
use ast_util;
1515
use attr;
16-
use codemap::{Span, respan, Spanned, DUMMY_SP};
16+
use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
1717
use ext::base::ExtCtxt;
1818
use fold::Folder;
1919
use owned_slice::OwnedSlice;
@@ -560,7 +560,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
560560
}
561561

562562
fn expr_field_access(&self, sp: Span, expr: Gc<ast::Expr>, ident: ast::Ident) -> Gc<ast::Expr> {
563-
self.expr(sp, ast::ExprField(expr, ident, Vec::new()))
563+
let field_name = token::get_ident(ident);
564+
let field_span = Span {
565+
lo: sp.lo - Pos::from_uint(field_name.get().len()),
566+
hi: sp.hi,
567+
expn_info: sp.expn_info,
568+
};
569+
570+
let id = Spanned { node: ident, span: field_span };
571+
self.expr(sp, ast::ExprField(expr, id, Vec::new()))
564572
}
565573
fn expr_addr_of(&self, sp: Span, e: Gc<ast::Expr>) -> Gc<ast::Expr> {
566574
self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e))

branches/try2/src/libsyntax/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ pub fn noop_fold_expr<T: Folder>(e: Gc<Expr>, folder: &mut T) -> Gc<Expr> {
876876
}
877877
ExprField(el, id, ref tys) => {
878878
ExprField(folder.fold_expr(el),
879-
folder.fold_ident(id),
879+
respan(id.span, folder.fold_ident(id.node)),
880880
tys.iter().map(|&x| folder.fold_ty(x)).collect())
881881
}
882882
ExprIndex(el, er) => {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ impl<'a> Parser<'a> {
17961796
ExprIndex(expr, idx)
17971797
}
17981798

1799-
pub fn mk_field(&mut self, expr: Gc<Expr>, ident: Ident,
1799+
pub fn mk_field(&mut self, expr: Gc<Expr>, ident: ast::SpannedIdent,
18001800
tys: Vec<P<Ty>>) -> ast::Expr_ {
18011801
ExprField(expr, ident, tys)
18021802
}
@@ -2090,7 +2090,8 @@ impl<'a> Parser<'a> {
20902090
e = self.mk_expr(lo, hi, nd);
20912091
}
20922092
_ => {
2093-
let field = self.mk_field(e, i, tys);
2093+
let id = spanned(dot, hi, i);
2094+
let field = self.mk_field(e, id, tys);
20942095
e = self.mk_expr(lo, hi, field)
20952096
}
20962097
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ impl<'a> State<'a> {
14871487
ast::ExprField(ref expr, id, ref tys) => {
14881488
try!(self.print_expr(&**expr));
14891489
try!(word(&mut self.s, "."));
1490-
try!(self.print_ident(id));
1490+
try!(self.print_ident(id.node));
14911491
if tys.len() > 0u {
14921492
try!(word(&mut self.s, "::<"));
14931493
try!(self.commasep(

branches/try2/src/test/compile-fail/method-missing-call.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ impl Point {
2828

2929
fn main() {
3030
let point: Point = Point::new();
31-
let px: int = point.get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
32-
//~^ NOTE maybe a missing `()` to call it? If not, try an anonymous function.
31+
let px: int = point
32+
.get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
33+
//~^ NOTE maybe a missing `()` to call it? If not, try an anonymous
34+
35+
// Ensure the span is useful
36+
let ys = &[1,2,3,4,5,6,7];
37+
let a = ys.iter()
38+
.map(|x| x)
39+
.filter(|&&x| x == 1)
40+
.filter_map; //~ ERROR attempted to take value of method `filter_map` on type
41+
//~^ NOTE maybe a missing `()` to call it? If not, try an anonymous function.
3342
}
3443

0 commit comments

Comments
 (0)