1
Fork 0

librustc: Remove uses of interner_get in librustc

This commit is contained in:
Patrick Walton 2014-01-31 16:03:55 -08:00 committed by Huon Wilson
parent 0d0a3dad68
commit a695b62118
6 changed files with 24 additions and 11 deletions

View file

@ -796,8 +796,9 @@ impl BorrowckCtxt {
self.append_loan_path_to_str_from_interior(lp_base, out); self.append_loan_path_to_str_from_interior(lp_base, out);
match fname { match fname {
mc::NamedField(ref fname) => { mc::NamedField(ref fname) => {
let string = token::get_ident(*fname);
out.push_char('.'); out.push_char('.');
out.push_str(token::interner_get(*fname)); out.push_str(string.get());
} }
mc::PositionalField(idx) => { mc::PositionalField(idx) => {
out.push_char('#'); // invent a notation here out.push_char('#'); // invent a notation here

View file

@ -1233,7 +1233,10 @@ pub fn ptr_sigil(ptr: PointerKind) -> ~str {
impl Repr for InteriorKind { impl Repr for InteriorKind {
fn repr(&self, _tcx: ty::ctxt) -> ~str { fn repr(&self, _tcx: ty::ctxt) -> ~str {
match *self { match *self {
InteriorField(NamedField(fld)) => token::interner_get(fld).to_owned(), InteriorField(NamedField(fld)) => {
let string = token::get_ident(fld);
string.get().to_owned()
}
InteriorField(PositionalField(i)) => format!("\\#{:?}", i), InteriorField(PositionalField(i)) => format!("\\#{:?}", i),
InteriorElement(_) => ~"[]", InteriorElement(_) => ~"[]",
} }

View file

@ -3344,9 +3344,10 @@ pub fn field_idx_strict(tcx: ty::ctxt, name: ast::Name, fields: &[field])
-> uint { -> uint {
let mut i = 0u; let mut i = 0u;
for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; } for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; }
let string = token::get_ident(name);
tcx.sess.bug(format!( tcx.sess.bug(format!(
"No field named `{}` found in the list of fields `{:?}`", "No field named `{}` found in the list of fields `{:?}`",
token::interner_get(name), string.get(),
fields.map(|f| tcx.sess.str_of(f.ident)))); fields.map(|f| tcx.sess.str_of(f.ident))));
} }

View file

@ -339,9 +339,11 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
if found_fields.contains(&i) { if found_fields.contains(&i) {
continue; continue;
} }
let string = token::get_ident(field.name);
tcx.sess.span_err(span, tcx.sess.span_err(span,
format!("pattern does not mention field `{}`", format!("pattern does not mention field `{}`",
token::interner_get(field.name))); string.get()));
} }
} }
} }

View file

@ -555,8 +555,10 @@ impl<'a> LookupContext<'a> {
return; // already visited return; // already visited
} }
} }
let method_name = token::get_ident(self.m_name);
debug!("push_candidates_from_impl: {} {} {}", debug!("push_candidates_from_impl: {} {} {}",
token::interner_get(self.m_name), method_name.get(),
impl_info.ident.repr(self.tcx()), impl_info.ident.repr(self.tcx()),
impl_info.methods.map(|m| m.ident).repr(self.tcx())); impl_info.methods.map(|m| m.ident).repr(self.tcx()));

View file

@ -2335,9 +2335,11 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
fcx.type_error_message( fcx.type_error_message(
expr.span, expr.span,
|actual| { |actual| {
let string = token::get_ident(field);
format!("attempted to take value of method `{}` on type `{}` \ format!("attempted to take value of method `{}` on type `{}` \
(try writing an anonymous function)", (try writing an anonymous function)",
token::interner_get(field), actual) string.get(),
actual)
}, },
expr_t, None); expr_t, None);
} }
@ -2346,9 +2348,11 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
fcx.type_error_message( fcx.type_error_message(
expr.span, expr.span,
|actual| { |actual| {
let string = token::get_ident(field);
format!("attempted access of field `{}` on type `{}`, \ format!("attempted access of field `{}` on type `{}`, \
but no field with that name was found", but no field with that name was found",
token::interner_get(field), actual) string.get(),
actual)
}, },
expr_t, None); expr_t, None);
} }
@ -2428,8 +2432,8 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
let name = class_field.name; let name = class_field.name;
let (_, seen) = *class_field_map.get(&name); let (_, seen) = *class_field_map.get(&name);
if !seen { if !seen {
missing_fields.push( let string = token::get_ident(name);
~"`" + token::interner_get(name) + "`"); missing_fields.push(~"`" + string.get() + "`");
} }
} }