Skip to content

Commit e9ce855

Browse files
pcwaltonhuonw
authored andcommitted
librustc: De-@str liveness
1 parent b265dd4 commit e9ce855

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc/middle/liveness.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ use std::vec;
120120
use syntax::ast::*;
121121
use syntax::codemap::Span;
122122
use syntax::parse::token::special_idents;
123+
use syntax::parse::token;
123124
use syntax::print::pprust::{expr_to_str, block_to_str};
124125
use syntax::{visit, ast_util};
125126
use syntax::visit::{Visitor, FnKind};
@@ -332,13 +333,14 @@ impl IrMaps {
332333
}
333334
}
334335

335-
pub fn variable_name(&self, var: Variable) -> @str {
336+
pub fn variable_name(&self, var: Variable) -> ~str {
336337
let var_kinds = self.var_kinds.borrow();
337338
match var_kinds.get()[var.get()] {
338339
Local(LocalInfo { ident: nm, .. }) | Arg(_, nm) => {
339-
self.tcx.sess.str_of(nm)
340+
let string = token::get_ident(nm.name);
341+
string.get().to_str()
340342
},
341-
ImplicitRet => @"<implicit-ret>"
343+
ImplicitRet => ~"<implicit-ret>"
342344
}
343345
}
344346
@@ -1669,7 +1671,7 @@ impl Liveness {
16691671
}
16701672
}
16711673

1672-
pub fn should_warn(&self, var: Variable) -> Option<@str> {
1674+
pub fn should_warn(&self, var: Variable) -> Option<~str> {
16731675
let name = self.ir.variable_name(var);
16741676
if name.len() == 0 || name[0] == ('_' as u8) { None } else { Some(name) }
16751677
}

0 commit comments

Comments
 (0)