librustc: De-@str ident() and str_of()

This commit is contained in:
Patrick Walton 2014-01-31 12:46:23 -08:00 committed by Huon Wilson
parent 19d4ea1cba
commit 21f86855dd
3 changed files with 11 additions and 8 deletions

View File

@ -352,9 +352,11 @@ pub fn no_landing_pads(&self) -> bool {
self.debugging_opt(NO_LANDING_PADS) self.debugging_opt(NO_LANDING_PADS)
} }
// pointless function, now... // DEPRECATED. This function results in a lot of allocations when they
pub fn str_of(&self, id: ast::Ident) -> @str { // are not necessary.
token::ident_to_str(&id) pub fn str_of(&self, id: ast::Ident) -> ~str {
let string = token::get_ident(id.name);
string.get().to_str()
} }
// pointless function, now... // pointless function, now...

View File

@ -176,8 +176,8 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
match ty::get(ty).sty { match ty::get(ty).sty {
ty::ty_bool => { ty::ty_bool => {
match *ctor { match *ctor {
val(const_bool(true)) => Some(@"true"), val(const_bool(true)) => Some(~"true"),
val(const_bool(false)) => Some(@"false"), val(const_bool(false)) => Some(~"false"),
_ => None _ => None
} }
} }
@ -197,7 +197,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
} }
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => { ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
match *ctor { match *ctor {
vec(n) => Some(format!("vectors of length {}", n).to_managed()), vec(n) => Some(format!("vectors of length {}", n)),
_ => None _ => None
} }
} }

View File

@ -446,8 +446,9 @@ pub fn tcx(&self) -> ty::ctxt {
} }
pub fn sess(&self) -> Session { self.fcx.ccx.sess } pub fn sess(&self) -> Session { self.fcx.ccx.sess }
pub fn ident(&self, ident: Ident) -> @str { pub fn ident(&self, ident: Ident) -> ~str {
token::ident_to_str(&ident) let string = token::get_ident(ident.name);
string.get().to_str()
} }
pub fn node_id_to_str(&self, id: ast::NodeId) -> ~str { pub fn node_id_to_str(&self, id: ast::NodeId) -> ~str {