remove get_ident and get_name, make as_str sound
This commit is contained in:
parent
9ca511cf63
commit
00a5e66f81
68 changed files with 433 additions and 534 deletions
|
|
@ -47,8 +47,7 @@ impl PathElem {
|
|||
|
||||
impl fmt::Display for PathElem {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let slot = token::get_name(self.name());
|
||||
write!(f, "{}", slot)
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1073,18 +1072,18 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
|
|||
match ii.node {
|
||||
ConstImplItem(..) => {
|
||||
format!("assoc const {} in {}{}",
|
||||
token::get_ident(ii.ident),
|
||||
ii.ident,
|
||||
map.path_to_string(id),
|
||||
id_str)
|
||||
}
|
||||
MethodImplItem(..) => {
|
||||
format!("method {} in {}{}",
|
||||
token::get_ident(ii.ident),
|
||||
ii.ident,
|
||||
map.path_to_string(id), id_str)
|
||||
}
|
||||
TypeImplItem(_) => {
|
||||
format!("assoc type {} in {}{}",
|
||||
token::get_ident(ii.ident),
|
||||
ii.ident,
|
||||
map.path_to_string(id),
|
||||
id_str)
|
||||
}
|
||||
|
|
@ -1103,13 +1102,13 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
|
|||
|
||||
format!("{} {} in {}{}",
|
||||
kind,
|
||||
token::get_ident(ti.ident),
|
||||
ti.ident,
|
||||
map.path_to_string(id),
|
||||
id_str)
|
||||
}
|
||||
Some(NodeVariant(ref variant)) => {
|
||||
format!("variant {} in {}{}",
|
||||
token::get_ident(variant.node.name),
|
||||
variant.node.name,
|
||||
map.path_to_string(id), id_str)
|
||||
}
|
||||
Some(NodeExpr(ref expr)) => {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ use syntax::attr::AttrMetaMethods;
|
|||
use syntax::codemap::{self, Span, mk_sp, Pos};
|
||||
use syntax::parse;
|
||||
use syntax::parse::token::InternedString;
|
||||
use syntax::parse::token;
|
||||
use syntax::visit;
|
||||
use log;
|
||||
|
||||
|
|
@ -181,19 +180,18 @@ impl<'a> CrateReader<'a> {
|
|||
fn extract_crate_info(&self, i: &ast::Item) -> Option<CrateInfo> {
|
||||
match i.node {
|
||||
ast::ItemExternCrate(ref path_opt) => {
|
||||
let ident = token::get_ident(i.ident);
|
||||
debug!("resolving extern crate stmt. ident: {} path_opt: {:?}",
|
||||
ident, path_opt);
|
||||
i.ident, path_opt);
|
||||
let name = match *path_opt {
|
||||
Some(name) => {
|
||||
validate_crate_name(Some(self.sess), name.as_str(),
|
||||
validate_crate_name(Some(self.sess), &name.as_str(),
|
||||
Some(i.span));
|
||||
name.as_str().to_string()
|
||||
name.to_string()
|
||||
}
|
||||
None => ident.to_string(),
|
||||
None => i.ident.to_string(),
|
||||
};
|
||||
Some(CrateInfo {
|
||||
ident: ident.to_string(),
|
||||
ident: i.ident.to_string(),
|
||||
name: name,
|
||||
id: i.id,
|
||||
should_link: should_link(i),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ use syntax::attr;
|
|||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::diagnostic::SpanHandler;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::parse::token;
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
use syntax::visit::Visitor;
|
||||
|
|
@ -83,11 +82,11 @@ pub struct EncodeContext<'a, 'tcx: 'a> {
|
|||
}
|
||||
|
||||
fn encode_name(rbml_w: &mut Encoder, name: ast::Name) {
|
||||
rbml_w.wr_tagged_str(tag_paths_data_name, &token::get_name(name));
|
||||
rbml_w.wr_tagged_str(tag_paths_data_name, &name.as_str());
|
||||
}
|
||||
|
||||
fn encode_impl_type_basename(rbml_w: &mut Encoder, name: ast::Name) {
|
||||
rbml_w.wr_tagged_str(tag_item_impl_type_basename, &token::get_name(name));
|
||||
rbml_w.wr_tagged_str(tag_item_impl_type_basename, &name.as_str());
|
||||
}
|
||||
|
||||
fn encode_def_id(rbml_w: &mut Encoder, id: DefId) {
|
||||
|
|
@ -349,7 +348,7 @@ fn encode_path<PI: Iterator<Item=PathElem>>(rbml_w: &mut Encoder, path: PI) {
|
|||
ast_map::PathMod(_) => tag_path_elem_mod,
|
||||
ast_map::PathName(_) => tag_path_elem_name
|
||||
};
|
||||
rbml_w.wr_tagged_str(tag, &token::get_name(pe.name()));
|
||||
rbml_w.wr_tagged_str(tag, &pe.name().as_str());
|
||||
}
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
|
@ -359,13 +358,13 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
|
|||
method_def_id: DefId,
|
||||
method_name: ast::Name) {
|
||||
debug!("(encode reexported static method) {}::{}",
|
||||
exp.name, token::get_name(method_name));
|
||||
exp.name, method_name);
|
||||
rbml_w.start_tag(tag_items_data_item_reexport);
|
||||
rbml_w.wr_tagged_u64(tag_items_data_item_reexport_def_id,
|
||||
def_to_u64(method_def_id));
|
||||
rbml_w.wr_tagged_str(tag_items_data_item_reexport_name,
|
||||
&format!("{}::{}", exp.name,
|
||||
token::get_name(method_name)));
|
||||
method_name));
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
||||
|
|
@ -499,15 +498,12 @@ fn encode_reexports(ecx: &EncodeContext,
|
|||
rbml_w.wr_tagged_u64(tag_items_data_item_reexport_def_id,
|
||||
def_to_u64(exp.def_id));
|
||||
rbml_w.wr_tagged_str(tag_items_data_item_reexport_name,
|
||||
exp.name.as_str());
|
||||
&exp.name.as_str());
|
||||
rbml_w.end_tag();
|
||||
encode_reexported_static_methods(ecx, rbml_w, path.clone(), exp);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
debug!("(encoding info for module) found no reexports for {}",
|
||||
id);
|
||||
}
|
||||
},
|
||||
None => debug!("(encoding info for module) found no reexports for {}", id),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -539,7 +535,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
|
|||
if let ast::ItemImpl(..) = item.node {
|
||||
let (ident, did) = (item.ident, item.id);
|
||||
debug!("(encoding info for module) ... encoding impl {} ({}/{})",
|
||||
token::get_ident(ident),
|
||||
ident,
|
||||
did, ecx.tcx.map.node_to_string(did));
|
||||
|
||||
rbml_w.wr_tagged_u64(tag_mod_impl, def_to_u64(local_def(did)));
|
||||
|
|
@ -656,7 +652,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
|
|||
});
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
debug!("encode_info_for_struct: doing {} {}",
|
||||
token::get_name(nm), id);
|
||||
nm, id);
|
||||
encode_struct_field_family(rbml_w, field.vis);
|
||||
encode_name(rbml_w, nm);
|
||||
encode_bounds_and_type_for_item(rbml_w, ecx, id);
|
||||
|
|
@ -816,7 +812,7 @@ fn encode_info_for_associated_const(ecx: &EncodeContext,
|
|||
impl_item_opt: Option<&ast::ImplItem>) {
|
||||
debug!("encode_info_for_associated_const({:?},{:?})",
|
||||
associated_const.def_id,
|
||||
token::get_name(associated_const.name));
|
||||
associated_const.name);
|
||||
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
|
||||
|
|
@ -854,7 +850,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
|||
impl_item_opt: Option<&ast::ImplItem>) {
|
||||
|
||||
debug!("encode_info_for_method: {:?} {:?}", m.def_id,
|
||||
token::get_name(m.name));
|
||||
m.name);
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
|
||||
encode_method_ty_fields(ecx, rbml_w, m);
|
||||
|
|
@ -899,7 +895,7 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
|||
impl_item_opt: Option<&ast::ImplItem>) {
|
||||
debug!("encode_info_for_associated_type({:?},{:?})",
|
||||
associated_type.def_id,
|
||||
token::get_name(associated_type.name));
|
||||
associated_type.name);
|
||||
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
|
||||
|
|
@ -937,7 +933,7 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
|
|||
for arg in &decl.inputs {
|
||||
let tag = tag_method_argument_name;
|
||||
if let ast::PatIdent(_, ref path1, _) = arg.pat.node {
|
||||
let name = token::get_name(path1.node.name);
|
||||
let name = path1.node.name.as_str();
|
||||
rbml_w.wr_tagged_bytes(tag, name.as_bytes());
|
||||
} else {
|
||||
rbml_w.wr_tagged_bytes(tag, &[]);
|
||||
|
|
@ -1562,7 +1558,7 @@ fn my_visit_foreign_item(ni: &ast::ForeignItem,
|
|||
index: &mut Vec<entry<i64>>) {
|
||||
debug!("writing foreign item {}::{}",
|
||||
ecx.tcx.map.path_to_string(ni.id),
|
||||
token::get_ident(ni.ident));
|
||||
ni.ident);
|
||||
|
||||
let abi = ecx.tcx.map.get_foreign_abi(ni.id);
|
||||
ecx.tcx.map.with_path(ni.id, |path| {
|
||||
|
|
@ -1748,7 +1744,7 @@ fn encode_defaulted(rbml_w: &mut Encoder, is_defaulted: bool) {
|
|||
fn encode_associated_type_names(rbml_w: &mut Encoder, names: &[ast::Name]) {
|
||||
rbml_w.start_tag(tag_associated_type_names);
|
||||
for &name in names {
|
||||
rbml_w.wr_tagged_str(tag_associated_type_name, &token::get_name(name));
|
||||
rbml_w.wr_tagged_str(tag_associated_type_name, &name.as_str());
|
||||
}
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,8 +149,7 @@ impl<'a> MacroLoader<'a> {
|
|||
let mut seen = HashSet::new();
|
||||
|
||||
for mut def in macros {
|
||||
let name = token::get_ident(def.ident);
|
||||
seen.insert(name.clone());
|
||||
let name = def.ident.name.as_str();
|
||||
|
||||
def.use_locally = match import.as_ref() {
|
||||
None => true,
|
||||
|
|
@ -161,18 +160,19 @@ impl<'a> MacroLoader<'a> {
|
|||
"allow_internal_unstable");
|
||||
debug!("load_macros: loaded: {:?}", def);
|
||||
self.macros.push(def);
|
||||
seen.insert(name);
|
||||
}
|
||||
|
||||
if let Some(sel) = import.as_ref() {
|
||||
for (name, span) in sel {
|
||||
if !seen.contains(name) {
|
||||
if !seen.contains(&name) {
|
||||
self.sess.span_err(*span, "imported macro not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (name, span) in &reexport {
|
||||
if !seen.contains(name) {
|
||||
if !seen.contains(&name) {
|
||||
self.sess.span_err(*span, "reexported macro not found");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use util::nodemap::FnvHashMap;
|
|||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::diagnostic::SpanHandler;
|
||||
use syntax::parse::token;
|
||||
|
||||
use rbml::writer::Encoder;
|
||||
|
||||
|
|
@ -136,7 +135,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx>) {
|
|||
cx.diag.handler().bug("cannot encode inference variable types");
|
||||
}
|
||||
ty::TyParam(ParamTy {space, idx, name}) => {
|
||||
mywrite!(w, "p[{}|{}|{}]", idx, space.to_uint(), token::get_name(name))
|
||||
mywrite!(w, "p[{}|{}|{}]", idx, space.to_uint(), name)
|
||||
}
|
||||
ty::TyStruct(def, substs) => {
|
||||
mywrite!(w, "a[{}|", (cx.ds)(def));
|
||||
|
|
@ -155,7 +154,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx>) {
|
|||
ty::TyProjection(ref data) => {
|
||||
mywrite!(w, "P[");
|
||||
enc_trait_ref(w, cx, data.trait_ref);
|
||||
mywrite!(w, "{}]", token::get_name(data.item_name));
|
||||
mywrite!(w, "{}]", data.item_name);
|
||||
}
|
||||
ty::TyError => {
|
||||
mywrite!(w, "e");
|
||||
|
|
@ -251,7 +250,7 @@ pub fn enc_region(w: &mut Encoder, cx: &ctxt, r: ty::Region) {
|
|||
data.param_id,
|
||||
data.space.to_uint(),
|
||||
data.index,
|
||||
token::get_name(data.name));
|
||||
data.name);
|
||||
}
|
||||
ty::ReFree(ref fr) => {
|
||||
mywrite!(w, "f[");
|
||||
|
|
@ -302,7 +301,7 @@ fn enc_bound_region(w: &mut Encoder, cx: &ctxt, br: ty::BoundRegion) {
|
|||
ty::BrNamed(d, name) => {
|
||||
mywrite!(w, "[{}|{}]",
|
||||
(cx.ds)(d),
|
||||
token::get_name(name));
|
||||
name);
|
||||
}
|
||||
ty::BrFresh(id) => {
|
||||
mywrite!(w, "f{}|", id);
|
||||
|
|
@ -410,7 +409,7 @@ pub fn enc_region_bounds<'a, 'tcx>(w: &mut Encoder,
|
|||
pub fn enc_type_param_def<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>,
|
||||
v: &ty::TypeParameterDef<'tcx>) {
|
||||
mywrite!(w, "{}:{}|{}|{}|{}|",
|
||||
token::get_name(v.name), (cx.ds)(v.def_id),
|
||||
v.name, (cx.ds)(v.def_id),
|
||||
v.space.to_uint(), v.index, (cx.ds)(v.default_def_id));
|
||||
enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
|
||||
enc_object_lifetime_default(w, cx, v.object_lifetime_default);
|
||||
|
|
@ -465,6 +464,6 @@ fn enc_projection_predicate<'a, 'tcx>(w: &mut Encoder,
|
|||
cx: &ctxt<'a, 'tcx>,
|
||||
data: &ty::ProjectionPredicate<'tcx>) {
|
||||
enc_trait_ref(w, cx, data.projection_ty.trait_ref);
|
||||
mywrite!(w, "{}|", token::get_name(data.projection_ty.item_name));
|
||||
mywrite!(w, "{}|", data.projection_ty.item_name);
|
||||
enc_ty(w, cx, data.ty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ use middle::ty::{self, Ty};
|
|||
use syntax::{ast, ast_util, codemap, fold};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::fold::Folder;
|
||||
use syntax::parse::token;
|
||||
use syntax::ptr::P;
|
||||
use syntax;
|
||||
|
||||
|
|
@ -156,10 +155,10 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
|
|||
ast::IITraitItem(_, ref ti) => ti.ident,
|
||||
ast::IIImplItem(_, ref ii) => ii.ident
|
||||
};
|
||||
debug!("Fn named: {}", token::get_ident(ident));
|
||||
debug!("Fn named: {}", ident);
|
||||
debug!("< Decoded inlined fn: {}::{}",
|
||||
path_as_str.unwrap(),
|
||||
token::get_ident(ident));
|
||||
ident);
|
||||
region::resolve_inlined_item(&tcx.sess, &tcx.region_maps, ii);
|
||||
decode_side_tables(dcx, ast_doc);
|
||||
match *ii {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ use syntax::ast_util;
|
|||
use syntax::codemap::{Span, Spanned, DUMMY_SP};
|
||||
use syntax::fold::{Folder, noop_fold_pat};
|
||||
use syntax::print::pprust::pat_to_string;
|
||||
use syntax::parse::token;
|
||||
use syntax::ptr::P;
|
||||
use syntax::visit::{self, Visitor, FnKind};
|
||||
use util::nodemap::FnvHashMap;
|
||||
|
|
@ -239,17 +238,17 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
|
|||
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
|
||||
if let Some(DefLocal(_)) = def {
|
||||
if cx.tcx.enum_variants(def_id).iter().any(|variant|
|
||||
token::get_name(variant.name) == token::get_name(ident.node.name)
|
||||
variant.name == ident.node.name
|
||||
&& variant.args.is_empty()
|
||||
) {
|
||||
span_warn!(cx.tcx.sess, p.span, E0170,
|
||||
"pattern binding `{}` is named the same as one \
|
||||
of the variants of the type `{}`",
|
||||
&token::get_ident(ident.node), pat_ty);
|
||||
ident.node, pat_ty);
|
||||
fileline_help!(cx.tcx.sess, p.span,
|
||||
"if you meant to match on a variant, \
|
||||
consider making the path in the pattern qualified: `{}::{}`",
|
||||
pat_ty, &token::get_ident(ident.node));
|
||||
pat_ty, ident.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1036,8 +1036,9 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
if let Struct(struct_id) = c {
|
||||
if let ast::ExprStruct(_, ref fields, _) = tcx.map.expect_expr(struct_id).node {
|
||||
// Check that the given field exists and evaluate it
|
||||
if let Some(f) = fields.iter().find(|f| f.ident.node.as_str()
|
||||
== field_name.node.as_str()) {
|
||||
// if the idents are compared run-pass/issue-19244 fails
|
||||
if let Some(f) = fields.iter().find(|f| f.ident.node.name
|
||||
== field_name.node.name) {
|
||||
return eval_const_expr_partial(tcx, &*f.expr, base_hint)
|
||||
} else {
|
||||
signal!(e, MissingStructField);
|
||||
|
|
|
|||
|
|
@ -194,9 +194,7 @@ impl<'tcx> ty::ctxt<'tcx> {
|
|||
|
||||
ty::ReEmpty => ("the empty lifetime".to_owned(), None),
|
||||
|
||||
ty::ReEarlyBound(ref data) => {
|
||||
(format!("{}", token::get_name(data.name)), None)
|
||||
}
|
||||
ty::ReEarlyBound(ref data) => (data.name.to_string(), None),
|
||||
|
||||
// I believe these cases should not occur (except when debugging,
|
||||
// perhaps)
|
||||
|
|
@ -1056,7 +1054,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
|||
// choice of lifetime name deterministic and thus easier to test.
|
||||
let mut names = Vec::new();
|
||||
for rn in region_names {
|
||||
let lt_name = token::get_name(*rn).to_string();
|
||||
let lt_name = rn.to_string();
|
||||
names.push(lt_name);
|
||||
}
|
||||
names.sort();
|
||||
|
|
@ -1544,15 +1542,15 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
infer::LateBoundRegion(_, br, infer::AssocTypeProjection(type_name)) => {
|
||||
format!(" for lifetime parameter {}in trait containing associated type `{}`",
|
||||
br_string(br), token::get_name(type_name))
|
||||
br_string(br), type_name)
|
||||
}
|
||||
infer::EarlyBoundRegion(_, name) => {
|
||||
format!(" for lifetime parameter `{}`",
|
||||
&token::get_name(name))
|
||||
name)
|
||||
}
|
||||
infer::BoundRegionInCoherence(name) => {
|
||||
format!(" for lifetime parameter `{}` in coherence check",
|
||||
&token::get_name(name))
|
||||
name)
|
||||
}
|
||||
infer::UpvarRegion(ref upvar_id, _) => {
|
||||
format!(" for capture of `{}` by closure",
|
||||
|
|
@ -1838,7 +1836,7 @@ impl LifeGiver {
|
|||
fn with_taken(taken: &[ast::LifetimeDef]) -> LifeGiver {
|
||||
let mut taken_ = HashSet::new();
|
||||
for lt in taken {
|
||||
let lt_name = token::get_name(lt.lifetime.name).to_string();
|
||||
let lt_name = lt.lifetime.name.to_string();
|
||||
taken_.insert(lt_name);
|
||||
}
|
||||
LifeGiver {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use syntax::abi::RustIntrinsic;
|
|||
use syntax::ast::DefId;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::parse::token;
|
||||
use syntax::visit::Visitor;
|
||||
use syntax::visit;
|
||||
|
||||
|
|
@ -61,16 +60,14 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
|
|||
if def_id.krate == ast::LOCAL_CRATE {
|
||||
match self.tcx.map.get(def_id.node) {
|
||||
NodeForeignItem(ref item) if intrinsic => {
|
||||
token::get_ident(item.ident) ==
|
||||
token::intern_and_get_ident("transmute")
|
||||
item.ident.name == "transmute"
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
} else {
|
||||
match csearch::get_item_path(self.tcx, def_id).last() {
|
||||
Some(ref last) if intrinsic => {
|
||||
token::get_name(last.name()) ==
|
||||
token::intern_and_get_ident("transmute")
|
||||
last.name() == "transmute"
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ use std::io;
|
|||
use std::rc::Rc;
|
||||
use syntax::ast::{self, NodeId, Expr};
|
||||
use syntax::codemap::{BytePos, original_sp, Span};
|
||||
use syntax::parse::token::{self, special_idents};
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::print::pprust::{expr_to_string, block_to_string};
|
||||
use syntax::ptr::P;
|
||||
use syntax::ast_util;
|
||||
|
|
@ -332,7 +332,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
|||
fn variable_name(&self, var: Variable) -> String {
|
||||
match self.var_kinds[var.get()] {
|
||||
Local(LocalInfo { name, .. }) | Arg(_, name) => {
|
||||
token::get_name(name).to_string()
|
||||
name.to_string()
|
||||
},
|
||||
ImplicitRet => "<implicit-ret>".to_string(),
|
||||
CleanExit => "<clean-exit>".to_string()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ use std::mem::replace;
|
|||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::parse::token;
|
||||
use syntax::print::pprust::lifetime_to_string;
|
||||
use syntax::visit;
|
||||
use syntax::visit::Visitor;
|
||||
|
|
@ -664,7 +663,7 @@ impl<'a> LifetimeContext<'a> {
|
|||
fn unresolved_lifetime_ref(&self, lifetime_ref: &ast::Lifetime) {
|
||||
span_err!(self.sess, lifetime_ref.span, E0261,
|
||||
"use of undeclared lifetime name `{}`",
|
||||
token::get_name(lifetime_ref.name));
|
||||
lifetime_ref.name);
|
||||
}
|
||||
|
||||
fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &Vec<ast::LifetimeDef>) {
|
||||
|
|
@ -676,7 +675,7 @@ impl<'a> LifetimeContext<'a> {
|
|||
if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
|
||||
span_err!(self.sess, lifetime.lifetime.span, E0262,
|
||||
"illegal lifetime parameter name: `{}`",
|
||||
token::get_name(lifetime.lifetime.name));
|
||||
lifetime.lifetime.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +687,7 @@ impl<'a> LifetimeContext<'a> {
|
|||
span_err!(self.sess, lifetime_j.lifetime.span, E0263,
|
||||
"lifetime name `{}` declared twice in \
|
||||
the same scope",
|
||||
token::get_name(lifetime_j.lifetime.name));
|
||||
lifetime_j.lifetime.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
|
|||
// When compiling with --test we don't enforce stability on the
|
||||
// compiler-generated test module, demarcated with `DUMMY_SP` plus the
|
||||
// name `__test`
|
||||
if item.span == DUMMY_SP && item.ident.as_str() == "__test" { return }
|
||||
if item.span == DUMMY_SP && item.ident.name == "__test" { return }
|
||||
|
||||
check_item(self.tcx, item, true,
|
||||
&mut |id, sp, stab| self.check(id, sp, stab));
|
||||
|
|
|
|||
|
|
@ -5292,19 +5292,13 @@ impl<'tcx> ctxt<'tcx> {
|
|||
match self.map.find(id) {
|
||||
Some(ast_map::NodeLocal(pat)) => {
|
||||
match pat.node {
|
||||
ast::PatIdent(_, ref path1, _) => {
|
||||
token::get_ident(path1.node)
|
||||
}
|
||||
ast::PatIdent(_, ref path1, _) => path1.node.name.as_str(),
|
||||
_ => {
|
||||
self.sess.bug(&format!("Variable id {} maps to {:?}, not local",
|
||||
id, pat));
|
||||
}
|
||||
self.sess.bug(&format!("Variable id {} maps to {:?}, not local", id, pat));
|
||||
},
|
||||
}
|
||||
}
|
||||
r => {
|
||||
self.sess.bug(&format!("Variable id {} maps to {:?}, not local",
|
||||
id, r));
|
||||
}
|
||||
},
|
||||
r => self.sess.bug(&format!("Variable id {} maps to {:?}, not local", id, r)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5396,9 +5390,9 @@ impl<'tcx> ctxt<'tcx> {
|
|||
for f in fields { if f.name == name { return i; } i += 1; }
|
||||
self.sess.bug(&format!(
|
||||
"no field named `{}` found in the list of fields `{:?}`",
|
||||
token::get_name(name),
|
||||
name,
|
||||
fields.iter()
|
||||
.map(|f| token::get_name(f.name).to_string())
|
||||
.map(|f| f.name.to_string())
|
||||
.collect::<Vec<String>>()));
|
||||
}
|
||||
|
||||
|
|
@ -5815,13 +5809,13 @@ impl<'tcx> ctxt<'tcx> {
|
|||
"expected {} integer constant",
|
||||
sign_desc);
|
||||
current_disr_val = attempt_fresh_value();
|
||||
}
|
||||
},
|
||||
Err(ref err) => {
|
||||
span_err!(self.sess, err.span, E0080,
|
||||
"constant evaluation error: {}",
|
||||
err.description());
|
||||
current_disr_val = attempt_fresh_value();
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
None => {
|
||||
|
|
@ -5830,14 +5824,14 @@ impl<'tcx> ctxt<'tcx> {
|
|||
if let Some(v) = repr_type.disr_incr(prev_disr_val) {
|
||||
v
|
||||
} else {
|
||||
self.report_discrim_overflow(v.span, v.node.name.as_str(),
|
||||
self.report_discrim_overflow(v.span, &v.node.name.name.as_str(),
|
||||
repr_type, prev_disr_val);
|
||||
attempt_fresh_value()
|
||||
}
|
||||
}
|
||||
None => ty::INITIAL_DISCRIMINANT_VALUE
|
||||
None => ty::INITIAL_DISCRIMINANT_VALUE,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
let variant_info = Rc::new(VariantInfo::from_ast_variant(self, &**v, current_disr_val));
|
||||
|
|
@ -6472,7 +6466,7 @@ impl<'tcx> ctxt<'tcx> {
|
|||
byte!(20);
|
||||
hash!(p.space);
|
||||
hash!(p.idx);
|
||||
hash!(token::get_name(p.name));
|
||||
hash!(p.name.as_str());
|
||||
}
|
||||
TyInfer(_) => unreachable!(),
|
||||
TyError => byte!(21),
|
||||
|
|
@ -6483,7 +6477,7 @@ impl<'tcx> ctxt<'tcx> {
|
|||
TyProjection(ref data) => {
|
||||
byte!(23);
|
||||
did(state, data.trait_ref.def_id);
|
||||
hash!(token::get_name(data.item_name));
|
||||
hash!(data.item_name.as_str());
|
||||
}
|
||||
}
|
||||
true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue