Skip to content

Commit 1165794

Browse files
committed
librustc: Remove uses of interner_get in librustc
1 parent f3d10bf commit 1165794

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

src/librustc/middle/borrowck/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,9 @@ impl BorrowckCtxt {
796796
self.append_loan_path_to_str_from_interior(lp_base, out);
797797
match fname {
798798
mc::NamedField(ref fname) => {
799+
let string = token::get_ident(*fname);
799800
out.push_char('.');
800-
out.push_str(token::interner_get(*fname));
801+
out.push_str(string.get());
801802
}
802803
mc::PositionalField(idx) => {
803804
out.push_char('#'); // invent a notation here

src/librustc/middle/mem_categorization.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,10 @@ pub fn ptr_sigil(ptr: PointerKind) -> ~str {
12331233
impl Repr for InteriorKind {
12341234
fn repr(&self, _tcx: ty::ctxt) -> ~str {
12351235
match *self {
1236-
InteriorField(NamedField(fld)) => token::interner_get(fld).to_owned(),
1236+
InteriorField(NamedField(fld)) => {
1237+
let string = token::get_ident(fld);
1238+
string.get().to_owned()
1239+
}
12371240
InteriorField(PositionalField(i)) => format!("\\#{:?}", i),
12381241
InteriorElement(_) => ~"[]",
12391242
}

src/librustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3334,9 +3334,10 @@ pub fn field_idx_strict(tcx: ty::ctxt, name: ast::Name, fields: &[field])
33343334
-> uint {
33353335
let mut i = 0u;
33363336
for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; }
3337+
let string = token::get_ident(name);
33373338
tcx.sess.bug(format!(
33383339
"No field named `{}` found in the list of fields `{:?}`",
3339-
token::interner_get(name),
3340+
string.get(),
33403341
fields.map(|f| tcx.sess.str_of(f.ident))));
33413342
}
33423343

src/librustc/middle/typeck/check/_match.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,11 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
339339
if found_fields.contains(&i) {
340340
continue;
341341
}
342+
343+
let string = token::get_ident(field.name);
342344
tcx.sess.span_err(span,
343345
format!("pattern does not mention field `{}`",
344-
token::interner_get(field.name)));
346+
string.get()));
345347
}
346348
}
347349
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ impl<'a> LookupContext<'a> {
555555
return; // already visited
556556
}
557557
}
558+
559+
let method_name = token::get_ident(self.m_name);
558560
debug!("push_candidates_from_impl: {} {} {}",
559-
token::interner_get(self.m_name),
561+
method_name.get(),
560562
impl_info.ident.repr(self.tcx()),
561563
impl_info.methods.map(|m| m.ident).repr(self.tcx()));
562564

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,9 +2335,11 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
23352335
fcx.type_error_message(
23362336
expr.span,
23372337
|actual| {
2338+
let string = token::get_ident(field);
23382339
format!("attempted to take value of method `{}` on type `{}` \
2339-
(try writing an anonymous function)",
2340-
token::interner_get(field), actual)
2340+
(try writing an anonymous function)",
2341+
string.get(),
2342+
actual)
23412343
},
23422344
expr_t, None);
23432345
}
@@ -2346,9 +2348,11 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
23462348
fcx.type_error_message(
23472349
expr.span,
23482350
|actual| {
2351+
let string = token::get_ident(field);
23492352
format!("attempted access of field `{}` on type `{}`, \
2350-
but no field with that name was found",
2351-
token::interner_get(field), actual)
2353+
but no field with that name was found",
2354+
string.get(),
2355+
actual)
23522356
},
23532357
expr_t, None);
23542358
}
@@ -2428,8 +2432,8 @@ pub fn check_expr_with_unifier(fcx: @FnCtxt,
24282432
let name = class_field.name;
24292433
let (_, seen) = *class_field_map.get(&name);
24302434
if !seen {
2431-
missing_fields.push(
2432-
~"`" + token::interner_get(name) + "`");
2435+
let string = token::get_ident(name);
2436+
missing_fields.push(~"`" + string.get() + "`");
24332437
}
24342438
}
24352439

0 commit comments

Comments
 (0)