Skip to content

Commit 61a5c4c

Browse files
committed
---
yaml --- r: 234826 b: refs/heads/tmp c: 64fb709 h: refs/heads/master v: v3
1 parent ff8591b commit 61a5c4c

File tree

20 files changed

+80
-92
lines changed

20 files changed

+80
-92
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: a4af95878630688f9c24a1170f73561f0f15397e
28+
refs/heads/tmp: 64fb709f99bdfb7d9a182eeaa068c7f209ce421b
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/librustc/middle/const_eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
314314
let field_pats = fields.iter().map(|field| codemap::Spanned {
315315
span: codemap::DUMMY_SP,
316316
node: hir::FieldPat {
317-
ident: field.ident.node,
317+
ident: ast::Ident::new(field.name.node),
318318
pat: const_expr_to_pat(tcx, &*field.expr, span),
319319
is_shorthand: false,
320320
},
@@ -1040,8 +1040,8 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10401040
if let hir::ExprStruct(_, ref fields, _) = tcx.map.expect_expr(struct_id).node {
10411041
// Check that the given field exists and evaluate it
10421042
// if the idents are compared run-pass/issue-19244 fails
1043-
if let Some(f) = fields.iter().find(|f| f.ident.node.name
1044-
== field_name.node.name) {
1043+
if let Some(f) = fields.iter().find(|f| f.name.node
1044+
== field_name.node) {
10451045
return eval_const_expr_partial(tcx, &*f.expr, base_hint)
10461046
} else {
10471047
signal!(e, MissingStructField);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
227227
hir::ExprMethodCall(..) => {
228228
self.lookup_and_handle_method(expr.id);
229229
}
230-
hir::ExprField(ref lhs, ref ident) => {
231-
self.handle_field_access(&**lhs, ident.node.name);
230+
hir::ExprField(ref lhs, ref name) => {
231+
self.handle_field_access(&**lhs, name.node);
232232
}
233233
hir::ExprTupField(ref lhs, idx) => {
234234
self.handle_tup_field_access(&**lhs, idx.node);

branches/tmp/src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
710710
-> bool
711711
{
712712
fields.iter().any(
713-
|f| f.ident.node.name == field.name)
713+
|f| f.name.node == field.name)
714714
}
715715
}
716716

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
474474
expr.id,
475475
expr,
476476
base_cmt);
477-
Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
477+
Ok(self.cat_field(expr, base_cmt, f_name.node, expr_ty))
478478
}
479479

480480
hir::ExprTupField(ref base, idx) => {

branches/tmp/src/librustc/middle/pat_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use util::nodemap::FnvHashMap;
1616
use syntax::ast;
1717
use rustc_front::hir;
1818
use rustc_front::util::walk_pat;
19-
use syntax::codemap::{Span, DUMMY_SP};
19+
use syntax::codemap::{Span, Spanned, DUMMY_SP};
2020

2121
pub type PatIdMap = FnvHashMap<ast::Ident, ast::NodeId>;
2222

@@ -109,7 +109,7 @@ pub fn pat_is_binding_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
109109
/// Call `it` on every "binding" in a pattern, e.g., on `a` in
110110
/// `match foo() { Some(a) => (), None => () }`
111111
pub fn pat_bindings<I>(dm: &DefMap, pat: &hir::Pat, mut it: I) where
112-
I: FnMut(hir::BindingMode, ast::NodeId, Span, &hir::SpannedIdent),
112+
I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned<ast::Ident>),
113113
{
114114
walk_pat(pat, |p| {
115115
match p.node {

branches/tmp/src/librustc/middle/stability.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ pub fn check_expr(tcx: &ty::ctxt, e: &hir::Expr,
418418
hir::ExprField(ref base_e, ref field) => {
419419
span = field.span;
420420
match tcx.expr_ty_adjusted(base_e).sty {
421-
ty::TyStruct(def, _) => def.struct_variant().field_named(field.node.name).did,
421+
ty::TyStruct(def, _) => def.struct_variant().field_named(field.node).did,
422422
_ => tcx.sess.span_bug(e.span,
423423
"stability::check_expr: named field access on non-struct")
424424
}
@@ -441,7 +441,7 @@ pub fn check_expr(tcx: &ty::ctxt, e: &hir::Expr,
441441
// in the construction expression.
442442
for field in expr_fields {
443443
let did = def.struct_variant()
444-
.field_named(field.ident.node.name)
444+
.field_named(field.name.node)
445445
.did;
446446
maybe_do_stability_check(tcx, did, field.span, cb);
447447
}

branches/tmp/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.node),
273-
ExprField(_, id) => SawExprField(id.node.name.as_str()),
273+
ExprField(_, name) => SawExprField(name.node.as_str()),
274274
ExprTupField(_, id) => SawExprTupField(id.node),
275275
ExprIndex(..) => SawExprIndex,
276276
ExprRange(..) => SawExprRange,

branches/tmp/src/librustc_front/fold.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,9 @@ pub fn noop_fold_struct_field<T: Folder>(f: StructField, fld: &mut T) -> StructF
721721
}
722722
}
723723

724-
pub fn noop_fold_field<T: Folder>(Field {ident, expr, span}: Field, folder: &mut T) -> Field {
724+
pub fn noop_fold_field<T: Folder>(Field {name, expr, span}: Field, folder: &mut T) -> Field {
725725
Field {
726-
ident: respan(ident.span, fold_ident(folder, ident.node)),
726+
name: respan(folder.new_span(name.span), folder.fold_name(name.node)),
727727
expr: folder.fold_expr(expr),
728728
span: folder.new_span(span)
729729
}
@@ -1050,9 +1050,9 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
10501050
ExprCall(folder.fold_expr(f),
10511051
args.move_map(|x| folder.fold_expr(x)))
10521052
}
1053-
ExprMethodCall(i, tps, args) => {
1053+
ExprMethodCall(name, tps, args) => {
10541054
ExprMethodCall(
1055-
respan(folder.new_span(i.span), fold_ident(folder, i.node)),
1055+
respan(folder.new_span(name.span), folder.fold_name(name.node)),
10561056
tps.move_map(|x| folder.fold_ty(x)),
10571057
args.move_map(|x| folder.fold_expr(x)))
10581058
}
@@ -1102,10 +1102,10 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
11021102
folder.fold_expr(el),
11031103
folder.fold_expr(er))
11041104
}
1105-
ExprField(el, ident) => {
1105+
ExprField(el, name) => {
11061106
ExprField(folder.fold_expr(el),
1107-
respan(folder.new_span(ident.span),
1108-
fold_ident(folder, ident.node)))
1107+
respan(folder.new_span(name.span),
1108+
folder.fold_name(name.node)))
11091109
}
11101110
ExprTupField(el, ident) => {
11111111
ExprTupField(folder.fold_expr(el),

branches/tmp/src/librustc_front/hir.rs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ use util;
5252
use std::fmt;
5353
use serialize::{Encodable, Encoder, Decoder};
5454

55-
56-
/// Function name (not all functions have names)
57-
pub type FnIdent = Option<Ident>;
58-
5955
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
6056
pub struct Lifetime {
6157
pub id: NodeId,
@@ -416,7 +412,7 @@ pub enum Pat_ {
416412
/// which it is. The resolver determines this, and
417413
/// records this pattern's NodeId in an auxiliary
418414
/// set (of "PatIdents that refer to nullary enums")
419-
PatIdent(BindingMode, SpannedIdent, Option<P<Pat>>),
415+
PatIdent(BindingMode, Spanned<Ident>, Option<P<Pat>>),
420416

421417
/// "None" means a * pattern where we don't bind the fields to names.
422418
PatEnum(Path, Option<Vec<P<Pat>>>),
@@ -564,13 +560,11 @@ pub struct Arm {
564560

565561
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
566562
pub struct Field {
567-
pub ident: SpannedIdent,
563+
pub name: Spanned<Name>,
568564
pub expr: P<Expr>,
569565
pub span: Span,
570566
}
571567

572-
pub type SpannedIdent = Spanned<Ident>;
573-
574568
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
575569
pub enum BlockCheckMode {
576570
DefaultBlock,
@@ -612,7 +606,7 @@ pub enum Expr_ {
612606
ExprCall(P<Expr>, Vec<P<Expr>>),
613607
/// A method call (`x.foo::<Bar, Baz>(a, b, c, d)`)
614608
///
615-
/// The `SpannedIdent` is the identifier for the method name.
609+
/// The `Spanned<Name>` is the identifier for the method name.
616610
/// The vector of `Ty`s are the ascripted type parameters for the method
617611
/// (within the angle brackets).
618612
///
@@ -622,7 +616,7 @@ pub enum Expr_ {
622616
///
623617
/// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
624618
/// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])`.
625-
ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<P<Expr>>),
619+
ExprMethodCall(Spanned<Name>, Vec<P<Ty>>, Vec<P<Expr>>),
626620
/// A tuple (`(a, b, c ,d)`)
627621
ExprTup(Vec<P<Expr>>),
628622
/// A binary operation (For example: `a + b`, `a * b`)
@@ -662,7 +656,7 @@ pub enum Expr_ {
662656
/// For example, `a += 1`.
663657
ExprAssignOp(BinOp, P<Expr>, P<Expr>),
664658
/// Access of a named struct field (`obj.foo`)
665-
ExprField(P<Expr>, SpannedIdent),
659+
ExprField(P<Expr>, Spanned<Name>),
666660
/// Access of an unnamed field of a struct or tuple-struct
667661
///
668662
/// For example, `foo.0`.
@@ -682,9 +676,9 @@ pub enum Expr_ {
682676
/// A referencing operation (`&a` or `&mut a`)
683677
ExprAddrOf(Mutability, P<Expr>),
684678
/// A `break`, with an optional label to break
685-
ExprBreak(Option<SpannedIdent>),
679+
ExprBreak(Option<Spanned<Ident>>),
686680
/// A `continue`, with an optional label
687-
ExprAgain(Option<SpannedIdent>),
681+
ExprAgain(Option<Spanned<Ident>>),
688682
/// A `return`, with an optional value to be returned
689683
ExprRet(Option<P<Expr>>),
690684

@@ -744,13 +738,6 @@ pub struct MutTy {
744738
pub mutbl: Mutability,
745739
}
746740

747-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
748-
pub struct TypeField {
749-
pub ident: Ident,
750-
pub mt: MutTy,
751-
pub span: Span,
752-
}
753-
754741
/// Represents a method's signature in a trait declaration,
755742
/// or in an implementation.
756743
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]

branches/tmp/src/librustc_front/lowering.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use hir;
1414

1515
use syntax::ast::*;
1616
use syntax::ptr::P;
17-
use syntax::codemap::Spanned;
17+
use syntax::codemap::{respan, Spanned};
1818
use syntax::owned_slice::OwnedSlice;
1919

2020

@@ -370,7 +370,10 @@ pub fn lower_struct_field(f: &StructField) -> hir::StructField {
370370
}
371371

372372
pub fn lower_field(f: &Field) -> hir::Field {
373-
hir::Field { ident: f.ident, expr: lower_expr(&f.expr), span: f.span }
373+
hir::Field {
374+
name: respan(f.ident.span, f.ident.node.name),
375+
expr: lower_expr(&f.expr), span: f.span
376+
}
374377
}
375378

376379
pub fn lower_mt(mt: &MutTy) -> hir::MutTy {
@@ -704,7 +707,7 @@ pub fn lower_expr(e: &Expr) -> P<hir::Expr> {
704707
}
705708
ExprMethodCall(i, ref tps, ref args) => {
706709
hir::ExprMethodCall(
707-
i,
710+
respan(i.span, i.node.name),
708711
tps.iter().map(|x| lower_ty(x)).collect(),
709712
args.iter().map(|x| lower_expr(x)).collect())
710713
}
@@ -755,7 +758,7 @@ pub fn lower_expr(e: &Expr) -> P<hir::Expr> {
755758
lower_expr(er))
756759
}
757760
ExprField(ref el, ident) => {
758-
hir::ExprField(lower_expr(el), ident)
761+
hir::ExprField(lower_expr(el), respan(ident.span, ident.node.name))
759762
}
760763
ExprTupField(ref el, ident) => {
761764
hir::ExprTupField(lower_expr(el), ident)

branches/tmp/src/librustc_front/print/pprust.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub use self::AnnNode::*;
1313
use syntax::abi;
1414
use syntax::ast;
1515
use syntax::owned_slice::OwnedSlice;
16-
use syntax::codemap::{self, CodeMap, BytePos};
16+
use syntax::codemap::{self, CodeMap, BytePos, Spanned};
1717
use syntax::diagnostic;
1818
use syntax::parse::token::{self, BinOpToken};
1919
use syntax::parse::lexer::comments;
@@ -1223,7 +1223,7 @@ impl<'a> State<'a> {
12231223
&fields[..],
12241224
|s, field| {
12251225
try!(s.ibox(indent_unit));
1226-
try!(s.print_ident(field.ident.node));
1226+
try!(s.print_name(field.name.node));
12271227
try!(s.word_space(":"));
12281228
try!(s.print_expr(&*field.expr));
12291229
s.end()
@@ -1265,13 +1265,13 @@ impl<'a> State<'a> {
12651265
}
12661266

12671267
fn print_expr_method_call(&mut self,
1268-
ident: hir::SpannedIdent,
1268+
name: Spanned<ast::Name>,
12691269
tys: &[P<hir::Ty>],
12701270
args: &[P<hir::Expr>]) -> io::Result<()> {
12711271
let base_args = &args[1..];
12721272
try!(self.print_expr(&*args[0]));
12731273
try!(word(&mut self.s, "."));
1274-
try!(self.print_ident(ident.node));
1274+
try!(self.print_name(name.node));
12751275
if !tys.is_empty() {
12761276
try!(word(&mut self.s, "::<"));
12771277
try!(self.commasep(Inconsistent, tys,
@@ -1329,8 +1329,8 @@ impl<'a> State<'a> {
13291329
hir::ExprCall(ref func, ref args) => {
13301330
try!(self.print_expr_call(&**func, &args[..]));
13311331
}
1332-
hir::ExprMethodCall(ident, ref tys, ref args) => {
1333-
try!(self.print_expr_method_call(ident, &tys[..], &args[..]));
1332+
hir::ExprMethodCall(name, ref tys, ref args) => {
1333+
try!(self.print_expr_method_call(name, &tys[..], &args[..]));
13341334
}
13351335
hir::ExprBinary(op, ref lhs, ref rhs) => {
13361336
try!(self.print_expr_binary(op, &**lhs, &**rhs));
@@ -1435,10 +1435,10 @@ impl<'a> State<'a> {
14351435
try!(self.word_space("="));
14361436
try!(self.print_expr(&**rhs));
14371437
}
1438-
hir::ExprField(ref expr, id) => {
1438+
hir::ExprField(ref expr, name) => {
14391439
try!(self.print_expr(&**expr));
14401440
try!(word(&mut self.s, "."));
1441-
try!(self.print_ident(id.node));
1441+
try!(self.print_name(name.node));
14421442
}
14431443
hir::ExprTupField(ref expr, id) => {
14441444
try!(self.print_expr(&**expr));

branches/tmp/src/librustc_mir/tcx/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ impl<'a,'tcx:'a> Mirror<Cx<'a,'tcx>> for &'tcx hir::Expr {
288288
hir::ExprLoop(ref body, _) =>
289289
ExprKind::Loop { condition: None,
290290
body: block::to_expr_ref(cx, body) },
291-
hir::ExprField(ref source, ident) =>
291+
hir::ExprField(ref source, name) =>
292292
ExprKind::Field { lhs: source.to_ref(),
293-
name: Field::Named(ident.node.name) },
293+
name: Field::Named(name.node) },
294294
hir::ExprTupField(ref source, ident) =>
295295
ExprKind::Field { lhs: source.to_ref(),
296296
name: Field::Indexed(ident.node) },

branches/tmp/src/librustc_mir/tcx/to_ref.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ impl<'a,'tcx:'a> ToRef<Cx<'a,'tcx>> for &'tcx hir::Field {
8686

8787
fn to_ref(self) -> FieldExprRef<Cx<'a,'tcx>> {
8888
FieldExprRef {
89-
name: Field::Named(self.ident.node.name),
89+
name: Field::Named(self.name.node),
9090
expr: self.expr.to_ref()
9191
}
9292
}
9393
}
94-

branches/tmp/src/librustc_privacy/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,12 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
866866

867867
fn visit_expr(&mut self, expr: &hir::Expr) {
868868
match expr.node {
869-
hir::ExprField(ref base, ident) => {
869+
hir::ExprField(ref base, name) => {
870870
if let ty::TyStruct(def, _) = self.tcx.expr_ty_adjusted(&**base).sty {
871871
self.check_field(expr.span,
872872
def,
873873
def.struct_variant(),
874-
NamedField(ident.node.name));
874+
NamedField(name.node));
875875
}
876876
}
877877
hir::ExprTupField(ref base, idx) => {
@@ -882,11 +882,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
882882
UnnamedField(idx.node));
883883
}
884884
}
885-
hir::ExprMethodCall(ident, _, _) => {
885+
hir::ExprMethodCall(name, _, _) => {
886886
let method_call = ty::MethodCall::expr(expr.id);
887887
let method = self.tcx.tables.borrow().method_map[&method_call];
888888
debug!("(privacy checking) checking impl method");
889-
self.check_method(expr.span, method.def_id, ident.node.name);
889+
self.check_method(expr.span, method.def_id, name.node);
890890
}
891891
hir::ExprStruct(..) => {
892892
let adt = self.tcx.expr_ty(expr).ty_adt_def().unwrap();

0 commit comments

Comments
 (0)