Skip to content

Commit eae9c0f

Browse files
committed
---
yaml --- r: 79708 b: refs/heads/try c: 39ca2db h: refs/heads/master v: v3
1 parent 297754b commit eae9c0f

File tree

11 files changed

+125
-115
lines changed

11 files changed

+125
-115
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: ba9fa89bfb4aae53db93e9ecac31807af96356fc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 54ae2800ffb30513f89ce13d27ac3c8d095d98ac
5-
refs/heads/try: 71e72ee86260880c281d8f8ec6d4d3a1eb55e461
5+
refs/heads/try: 39ca2dbbc5072713b91a4f444bb1fdcd0d69e19c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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

Lines changed: 85 additions & 78 deletions
Large diffs are not rendered by default.

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
14821482
let pat_repr = adt::represent_type(bcx.ccx(), pat_ty);
14831483
do expr::with_field_tys(tcx, pat_ty, None) |discr, field_tys| {
14841484
let rec_vals = rec_fields.map(|field_name| {
1485-
let ix = ty::field_idx_strict(tcx, *field_name, field_tys);
1485+
let ix = ty::field_idx_strict(tcx, field_name.name, field_tys);
14861486
adt::trans_field_ptr(bcx, pat_repr, val, discr, ix)
14871487
});
14881488
compile_submatch(
@@ -2159,7 +2159,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
21592159
let pat_repr = adt::represent_type(bcx.ccx(), pat_ty);
21602160
do expr::with_field_tys(tcx, pat_ty, None) |discr, field_tys| {
21612161
for f in fields.iter() {
2162-
let ix = ty::field_idx_strict(tcx, f.ident, field_tys);
2162+
let ix = ty::field_idx_strict(tcx, f.ident.name, field_tys);
21632163
let fldptr = adt::trans_field_ptr(bcx, pat_repr, val,
21642164
discr, ix);
21652165
bcx = bind_irrefutable_pat(bcx, f.pat, fldptr, binding_mode);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::Expr) -> ValueRef {
374374
let brepr = adt::represent_type(cx, bt);
375375
let bv = const_expr(cx, base);
376376
do expr::with_field_tys(cx.tcx, bt, None) |discr, field_tys| {
377-
let ix = ty::field_idx_strict(cx.tcx, field, field_tys);
377+
let ix = ty::field_idx_strict(cx.tcx, field.name, field_tys);
378378
adt::const_get_field(cx, brepr, bv, discr, ix)
379379
}
380380
}
@@ -502,7 +502,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::Expr) -> ValueRef {
502502
|discr, field_tys| {
503503
let cs: ~[ValueRef] = field_tys.iter().enumerate()
504504
.map(|(ix, &field_ty)| {
505-
match fs.iter().find(|f| field_ty.ident == f.ident) {
505+
match fs.iter().find(|f| field_ty.ident.name == f.ident.name) {
506506
Some(f) => const_expr(cx, (*f).expr),
507507
None => {
508508
match base_val {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
903903
let base_datum = unpack_datum!(bcx, trans_to_datum(bcx, base));
904904
let repr = adt::represent_type(bcx.ccx(), base_datum.ty);
905905
do with_field_tys(bcx.tcx(), base_datum.ty, None) |discr, field_tys| {
906-
let ix = ty::field_idx_strict(bcx.tcx(), field, field_tys);
906+
let ix = ty::field_idx_strict(bcx.tcx(), field.name, field_tys);
907907
DatumBlock {
908908
datum: do base_datum.get_element(bcx,
909909
field_tys[ix].mt.ty,
@@ -1176,7 +1176,8 @@ fn trans_rec_or_struct(bcx: @mut Block,
11761176
let mut need_base = vec::from_elem(field_tys.len(), true);
11771177

11781178
let numbered_fields = do fields.map |field| {
1179-
let opt_pos = field_tys.iter().position(|field_ty| field_ty.ident == field.ident);
1179+
let opt_pos = field_tys.iter().position(|field_ty|
1180+
field_ty.ident.name == field.ident.name);
11801181
match opt_pos {
11811182
Some(i) => {
11821183
need_base[i] = false;

branches/try/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ pub fn trans_static_method_callee(bcx: @mut Block,
295295
pub fn method_with_name(ccx: &mut CrateContext,
296296
impl_id: ast::DefId,
297297
name: ast::Ident) -> ast::DefId {
298+
// NOTE : SHOULD USE NAME (chonged later)
298299
let meth_id_opt = ccx.impl_method_cache.find_copy(&(impl_id, name));
299300
match meth_id_opt {
300301
Some(m) => return m,
@@ -303,7 +304,7 @@ pub fn method_with_name(ccx: &mut CrateContext,
303304

304305
let imp = ccx.tcx.impls.find(&impl_id)
305306
.expect("could not find impl while translating");
306-
let meth = imp.methods.iter().find(|m| m.ident == name)
307+
let meth = imp.methods.iter().find(|m| m.ident.name == name.name)
307308
.expect("could not find method while translating");
308309

309310
ccx.impl_method_cache.insert((impl_id, name), meth.def_id);

branches/try/src/librustc/middle/ty.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,19 +3360,19 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
33603360
}
33613361
}
33623362

3363-
pub fn field_idx(id: ast::Ident, fields: &[field]) -> Option<uint> {
3363+
pub fn field_idx(name: ast::Name, fields: &[field]) -> Option<uint> {
33643364
let mut i = 0u;
3365-
for f in fields.iter() { if f.ident == id { return Some(i); } i += 1u; }
3365+
for f in fields.iter() { if f.ident.name == name { return Some(i); } i += 1u; }
33663366
return None;
33673367
}
33683368

3369-
pub fn field_idx_strict(tcx: ty::ctxt, id: ast::Ident, fields: &[field])
3369+
pub fn field_idx_strict(tcx: ty::ctxt, name: ast::Name, fields: &[field])
33703370
-> uint {
33713371
let mut i = 0u;
3372-
for f in fields.iter() { if f.ident == id { return i; } i += 1u; }
3372+
for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; }
33733373
tcx.sess.bug(fmt!(
33743374
"No field named `%s` found in the list of fields `%?`",
3375-
tcx.sess.str_of(id),
3375+
token::interner_get(name),
33763376
fields.map(|f| tcx.sess.str_of(f.ident))));
33773377
}
33783378

branches/try/src/librustc/middle/typeck/check/method.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ use syntax::ast::{sty_uniq, sty_static, NodeId};
105105
use syntax::ast::{MutMutable, MutImmutable};
106106
use syntax::ast;
107107
use syntax::ast_map;
108+
use syntax::parse::token;
108109

109110
#[deriving(Eq)]
110111
pub enum CheckTraitsFlag {
@@ -126,7 +127,7 @@ pub fn lookup(
126127
self_expr: @ast::Expr, // The expression `a`.
127128
callee_id: NodeId, /* Where to store `a.b`'s type,
128129
* also the scope of the call */
129-
m_name: ast::Ident, // The ident `b`.
130+
m_name: ast::Name, // The name `b`.
130131
self_ty: ty::t, // The type of `a`.
131132
supplied_tps: &[ty::t], // The list of types X, Y, ... .
132133
deref_args: check::DerefArgs, // Whether we autopointer first.
@@ -173,7 +174,7 @@ pub struct LookupContext<'self> {
173174
expr: @ast::Expr,
174175
self_expr: @ast::Expr,
175176
callee_id: NodeId,
176-
m_name: ast::Ident,
177+
m_name: ast::Name,
177178
supplied_tps: &'self [ty::t],
178179
impl_dups: @mut HashSet<DefId>,
179180
inherent_candidates: @mut ~[Candidate],
@@ -515,7 +516,7 @@ impl<'self> LookupContext<'self> {
515516
let trait_methods = ty::trait_methods(tcx, bound_trait_ref.def_id);
516517
match trait_methods.iter().position(|m| {
517518
m.explicit_self != ast::sty_static &&
518-
m.ident == self.m_name })
519+
m.ident.name == self.m_name })
519520
{
520521
Some(pos) => {
521522
let method = trait_methods[pos];
@@ -558,12 +559,12 @@ impl<'self> LookupContext<'self> {
558559
return; // already visited
559560
}
560561
debug!("push_candidates_from_impl: %s %s %s",
561-
self.m_name.repr(self.tcx()),
562+
token::interner_get(self.m_name),
562563
impl_info.ident.repr(self.tcx()),
563564
impl_info.methods.map(|m| m.ident).repr(self.tcx()));
564565

565566
let idx = {
566-
match impl_info.methods.iter().position(|m| m.ident == self.m_name) {
567+
match impl_info.methods.iter().position(|m| m.ident.name == self.m_name) {
567568
Some(idx) => idx,
568569
None => { return; } // No method with the right name.
569570
}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,10 +1117,10 @@ pub fn impl_self_ty(vcx: &VtableContext,
11171117
pub fn lookup_field_ty(tcx: ty::ctxt,
11181118
class_id: ast::DefId,
11191119
items: &[ty::field_ty],
1120-
fieldname: ast::Ident,
1120+
fieldname: ast::Name,
11211121
substs: &ty::substs) -> Option<ty::t> {
11221122

1123-
let o_field = items.iter().find(|f| f.ident == fieldname);
1123+
let o_field = items.iter().find(|f| f.ident.name == fieldname);
11241124
do o_field.map() |f| {
11251125
ty::lookup_field_type(tcx, class_id, f.id, substs)
11261126
}
@@ -1553,7 +1553,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
15531553
expr,
15541554
rcvr,
15551555
callee_id,
1556-
method_name,
1556+
method_name.name,
15571557
expr_t,
15581558
tps,
15591559
DontDerefArgs,
@@ -1637,7 +1637,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
16371637
op_ex: @ast::Expr,
16381638
self_ex: @ast::Expr,
16391639
self_t: ty::t,
1640-
opname: ast::Ident,
1640+
opname: ast::Name,
16411641
args: ~[@ast::Expr],
16421642
deref_args: DerefArgs,
16431643
autoderef_receiver: AutoderefReceiverFlag,
@@ -1777,7 +1777,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
17771777
lhs_resolved_t, None)
17781778
};
17791779
return lookup_op_method(fcx, callee_id, ex, lhs_expr, lhs_resolved_t,
1780-
fcx.tcx().sess.ident_of(*name),
1780+
token::intern(*name),
17811781
~[rhs], DoDerefArgs, DontAutoderefReceiver, if_op_unbound,
17821782
expected_result);
17831783
}
@@ -1811,7 +1811,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
18111811
-> ty::t {
18121812
lookup_op_method(
18131813
fcx, callee_id, ex, rhs_expr, rhs_t,
1814-
fcx.tcx().sess.ident_of(mname), ~[],
1814+
token::intern(mname), ~[],
18151815
DoDerefArgs, DontAutoderefReceiver,
18161816
|| {
18171817
fcx.type_error_message(ex.span, |actual| {
@@ -1937,7 +1937,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
19371937
fn check_field(fcx: @mut FnCtxt,
19381938
expr: @ast::Expr,
19391939
base: @ast::Expr,
1940-
field: ast::Ident,
1940+
field: ast::Name,
19411941
tys: &[ast::Ty]) {
19421942
let tcx = fcx.ccx.tcx;
19431943
let bot = check_expr(fcx, base);
@@ -1985,7 +1985,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
19851985
|actual| {
19861986
fmt!("attempted to take value of method `%s` on type `%s` \
19871987
(try writing an anonymous function)",
1988-
tcx.sess.str_of(field), actual)
1988+
token::interner_get(field), actual)
19891989
},
19901990
expr_t, None);
19911991
}
@@ -1996,7 +1996,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
19961996
|actual| {
19971997
fmt!("attempted access of field `%s` on type `%s`, \
19981998
but no field with that name was found",
1999-
tcx.sess.str_of(field), actual)
1999+
token::interner_get(field), actual)
20002000
},
20012001
expr_t, None);
20022002
}
@@ -2018,7 +2018,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
20182018
let mut class_field_map = HashMap::new();
20192019
let mut fields_found = 0;
20202020
for field in field_types.iter() {
2021-
class_field_map.insert(field.ident, (field.id, false));
2021+
class_field_map.insert(field.ident.name, (field.id, false));
20222022
}
20232023

20242024
let mut error_happened = false;
@@ -2027,7 +2027,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
20272027
for field in ast_fields.iter() {
20282028
let mut expected_field_type = ty::mk_err();
20292029

2030-
let pair = class_field_map.find(&field.ident).map_move(|x| *x);
2030+
let pair = class_field_map.find(&field.ident.name).map_move(|x| *x);
20312031
match pair {
20322032
None => {
20332033
tcx.sess.span_err(
@@ -2048,7 +2048,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
20482048
ty::lookup_field_type(
20492049
tcx, class_id, field_id, &substitutions);
20502050
class_field_map.insert(
2051-
field.ident, (field_id, true));
2051+
field.ident.name, (field_id, true));
20522052
fields_found += 1;
20532053
}
20542054
}
@@ -2070,11 +2070,11 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
20702070
if fields_found < field_types.len() {
20712071
let mut missing_fields = ~[];
20722072
for class_field in field_types.iter() {
2073-
let name = class_field.ident;
2073+
let name = class_field.ident.name;
20742074
let (_, seen) = *class_field_map.get(&name);
20752075
if !seen {
20762076
missing_fields.push(
2077-
~"`" + tcx.sess.str_of(name) + "`");
2077+
~"`" + token::interner_get(name) + "`");
20782078
}
20792079
}
20802080

@@ -2846,7 +2846,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
28462846
}
28472847
}
28482848
ast::ExprField(base, field, ref tys) => {
2849-
check_field(fcx, expr, base, field, *tys);
2849+
check_field(fcx, expr, base, field.name, *tys);
28502850
}
28512851
ast::ExprIndex(callee_id, base, idx) => {
28522852
check_expr(fcx, base);
@@ -2886,7 +2886,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
28862886
expr,
28872887
base,
28882888
resolved,
2889-
index_ident,
2889+
index_ident.name,
28902890
~[idx],
28912891
DoDerefArgs,
28922892
AutoderefReceiver,

branches/try/src/librustc/middle/typeck/coherence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,13 @@ impl CoherenceChecker {
553553
let mut provided_names = HashSet::new();
554554
// Implemented methods
555555
for elt in all_methods.iter() {
556-
provided_names.insert(elt.ident);
556+
provided_names.insert(elt.ident.name);
557557
}
558558

559559
let r = ty::trait_methods(tcx, trait_did);
560560
for method in r.iter() {
561561
debug!("checking for %s", method.ident.repr(tcx));
562-
if provided_names.contains(&method.ident) { loop; }
562+
if provided_names.contains(&method.ident.name) { loop; }
563563

564564
tcx.sess.span_err(trait_ref_span,
565565
fmt!("missing method `%s`",

branches/try/src/librustc/middle/typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ pub fn check_methods_against_trait(ccx: &CrateCtxt,
698698
// we'll catch it in coherence
699699
let trait_ms = ty::trait_methods(tcx, trait_ref.def_id);
700700
for impl_m in impl_ms.iter() {
701-
match trait_ms.iter().find(|trait_m| trait_m.ident == impl_m.mty.ident) {
701+
match trait_ms.iter().find(|trait_m| trait_m.ident.name == impl_m.mty.ident.name) {
702702
Some(trait_m) => {
703703
let num_impl_tps = generics.ty_params.len();
704704
compare_impl_method(

0 commit comments

Comments
 (0)