ident->name in middle

This commit is contained in:
John Clements 2013-09-09 16:43:27 -07:00
parent af259a651d
commit 42b1694cca
2 changed files with 6 additions and 4 deletions

View file

@ -671,7 +671,8 @@ fn enter_opt<'r>(bcx: @mut Block,
let mut reordered_patterns = ~[];
let r = ty::lookup_struct_fields(tcx, struct_id);
for field in r.iter() {
match field_pats.iter().find(|p| p.ident == field.ident) {
match field_pats.iter().find(|p| p.ident.name
== field.ident.name) {
None => reordered_patterns.push(dummy),
Some(fp) => reordered_patterns.push(fp.pat)
}
@ -752,7 +753,7 @@ fn enter_rec_or_struct<'r>(bcx: @mut Block,
ast::PatStruct(_, ref fpats, _) => {
let mut pats = ~[];
for fname in fields.iter() {
match fpats.iter().find(|p| p.ident == *fname) {
match fpats.iter().find(|p| p.ident.name == fname.name) {
None => pats.push(dummy),
Some(pat) => pats.push(pat.pat)
}
@ -1102,7 +1103,7 @@ fn collect_record_or_struct_fields(bcx: @mut Block,
fn extend(idents: &mut ~[ast::Ident], field_pats: &[ast::FieldPat]) {
for field_pat in field_pats.iter() {
let field_ident = field_pat.ident;
if !idents.iter().any(|x| *x == field_ident) {
if !idents.iter().any(|x| x.name == field_ident.name) {
idents.push(field_ident);
}
}

View file

@ -256,7 +256,8 @@ impl Reflector {
let fields = ty::struct_fields(tcx, did, substs);
let mut named_fields = false;
if !fields.is_empty() {
named_fields = fields[0].ident != special_idents::unnamed_field;
named_fields =
fields[0].ident.name != special_idents::unnamed_field.name;
}
let extra = ~[self.c_slice(ty_to_str(tcx, t).to_managed()),