diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index b19c0f2ecc5d2..8addc06c8840d 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -520,9 +520,9 @@ fn encode_info_for_mod(ecx: &EncodeContext, }); if let hir::ItemImpl(..) = item.node { - let (ident, did) = (item.name, item.id); + let (name, did) = (item.name, item.id); debug!("(encoding info for module) ... encoding impl {} ({}/{})", - ident, + name, did, ecx.tcx.map.node_to_string(did)); rbml_w.wr_tagged_u64(tag_mod_impl, def_to_u64(DefId::local(did))); diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 7856890724cb6..abc0429e7d297 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -184,8 +184,8 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> { } '[' => { let def = self.parse_def(RegionParameter); - let ident = token::str_to_ident(&self.parse_str(']')); - ty::BrNamed(def, ident.name) + let name = token::intern(&self.parse_str(']')); + ty::BrNamed(def, name) } 'f' => { let id = self.parse_u32(); @@ -219,12 +219,12 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> { assert_eq!(self.next(), '|'); let index = self.parse_u32(); assert_eq!(self.next(), '|'); - let nm = token::str_to_ident(&self.parse_str(']')); + let name = token::intern(&self.parse_str(']')); ty::ReEarlyBound(ty::EarlyBoundRegion { param_id: node_id, space: space, index: index, - name: nm.name + name: name }) } 'f' => { @@ -598,7 +598,7 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> { ty::ProjectionPredicate { projection_ty: ty::ProjectionTy { trait_ref: self.parse_trait_ref(), - item_name: token::str_to_ident(&self.parse_str('|')).name, + item_name: token::intern(&self.parse_str('|')), }, ty: self.parse_ty(), } diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index 60aebd9cd4226..4dd0cdb1873a0 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -284,7 +284,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } hir::ExprBreak(label) => { - let loop_scope = self.find_scope(expr, label.map(|l| l.node)); + let loop_scope = self.find_scope(expr, label.map(|l| l.node.name)); let b = self.add_ast_node(expr.id, &[pred]); self.add_exiting_edge(expr, b, loop_scope, loop_scope.break_index); @@ -292,7 +292,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } hir::ExprAgain(label) => { - let loop_scope = self.find_scope(expr, label.map(|l| l.node)); + let loop_scope = self.find_scope(expr, label.map(|l| l.node.name)); let a = self.add_ast_node(expr.id, &[pred]); self.add_exiting_edge(expr, a, loop_scope, loop_scope.continue_index); @@ -586,7 +586,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { fn find_scope(&self, expr: &hir::Expr, - label: Option) -> LoopScope { + label: Option) -> LoopScope { if label.is_none() { return *self.loop_scopes.last().unwrap(); } diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 132efc1ff8826..caedc811842a0 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -114,7 +114,7 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O ps: &mut pprust::State, node: pprust::AnnNode) -> io::Result<()> { let id = match node { - pprust::NodeIdent(_) | pprust::NodeName(_) => 0, + pprust::NodeName(_) => 0, pprust::NodeExpr(expr) => expr.id, pprust::NodeBlock(blk) => blk.id, pprust::NodeItem(_) | pprust::NodeSubItem(_) => 0, diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index fa2856e2f30c3..802b09a1a65e8 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1015,12 +1015,12 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> { }, None => None }; - let (fn_decl, generics, unsafety, constness, ident, expl_self, span) + let (fn_decl, generics, unsafety, constness, name, expl_self, span) = node_inner.expect("expect item fn"); let rebuilder = Rebuilder::new(self.tcx, fn_decl, expl_self, generics, same_regions, &life_giver); let (fn_decl, expl_self, generics) = rebuilder.rebuild(); - self.give_expl_lifetime_param(&fn_decl, unsafety, constness, ident, + self.give_expl_lifetime_param(&fn_decl, unsafety, constness, name, expl_self.as_ref(), &generics, span); } } @@ -1127,7 +1127,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { names.push(lt_name); } names.sort(); - let name = token::str_to_ident(&names[0]).name; + let name = token::intern(&names[0]); return (name_to_dummy_lifetime(name), Kept); } return (self.life_giver.give_lifetime(), Fresh); @@ -1938,8 +1938,7 @@ impl LifeGiver { let mut s = String::from("'"); s.push_str(&num_to_string(self.counter.get())); if !self.taken.contains(&s) { - lifetime = name_to_dummy_lifetime( - token::str_to_ident(&s[..]).name); + lifetime = name_to_dummy_lifetime(token::intern(&s[..])); self.generated.borrow_mut().push(lifetime); break; } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 9bb19bb37d8e4..d57f7590dadf5 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -383,7 +383,7 @@ fn visit_fn(ir: &mut IrMaps, &*arg.pat, |_bm, arg_id, _x, path1| { debug!("adding argument {}", arg_id); - let name = path1.node.name; + let name = path1.node; fn_maps.add_variable(Arg(arg_id, name)); }) }; @@ -416,7 +416,7 @@ fn visit_fn(ir: &mut IrMaps, fn visit_local(ir: &mut IrMaps, local: &hir::Local) { pat_util::pat_bindings(&ir.tcx.def_map, &*local.pat, |_, p_id, sp, path1| { debug!("adding local variable {}", p_id); - let name = path1.node.name; + let name = path1.node; ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_variable(Local(LocalInfo { id: p_id, @@ -431,7 +431,7 @@ fn visit_arm(ir: &mut IrMaps, arm: &hir::Arm) { pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| { debug!("adding local variable {} from match with bm {:?}", p_id, bm); - let name = path1.node.name; + let name = path1.node; ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_variable(Local(LocalInfo { id: p_id, @@ -688,7 +688,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } fn find_loop_scope(&self, - opt_label: Option, + opt_label: Option, id: NodeId, sp: Span) -> NodeId { @@ -1049,7 +1049,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprBreak(opt_label) => { // Find which label this break jumps to - let sc = self.find_loop_scope(opt_label.map(|l| l.node), expr.id, expr.span); + let sc = self.find_loop_scope(opt_label.map(|l| l.node.name), expr.id, expr.span); // Now that we know the label we're going to, // look it up in the break loop nodes table @@ -1063,7 +1063,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprAgain(opt_label) => { // Find which label this expr continues to - let sc = self.find_loop_scope(opt_label.map(|l| l.node), expr.id, expr.span); + let sc = self.find_loop_scope(opt_label.map(|l| l.node.name), expr.id, expr.span); // Now that we know the label we're going to, // look it up in the continue loop nodes table @@ -1555,8 +1555,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { |_bm, p_id, sp, path1| { let var = self.variable(p_id, sp); // Ignore unused self. - let ident = path1.node; - if ident.name != special_idents::self_.name { + let name = path1.node; + if name != special_idents::self_.name { self.warn_about_unused(sp, p_id, entry_ln, var); } }) diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index 6f55ddfdfd201..f72a945741ff7 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -16,9 +16,9 @@ use util::nodemap::FnvHashMap; use syntax::ast; use rustc_front::hir; use rustc_front::util::walk_pat; -use syntax::codemap::{Span, Spanned, DUMMY_SP}; +use syntax::codemap::{respan, Span, Spanned, DUMMY_SP}; -pub type PatIdMap = FnvHashMap; +pub type PatIdMap = FnvHashMap; // This is used because same-named variables in alternative patterns need to // use the NodeId of their namesake in the first pattern. @@ -109,12 +109,26 @@ pub fn pat_is_binding_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool { /// Call `it` on every "binding" in a pattern, e.g., on `a` in /// `match foo() { Some(a) => (), None => () }` pub fn pat_bindings(dm: &DefMap, pat: &hir::Pat, mut it: I) where + I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned), +{ + walk_pat(pat, |p| { + match p.node { + hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(dm, p) => { + it(binding_mode, p.id, p.span, &respan(pth.span, pth.node.name)); + } + _ => {} + } + true + }); +} + +pub fn pat_bindings_hygienic(dm: &DefMap, pat: &hir::Pat, mut it: I) where I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned), { walk_pat(pat, |p| { match p.node { hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(dm, p) => { - it(binding_mode, p.id, p.span, pth); + it(binding_mode, p.id, p.span, &respan(pth.span, pth.node)); } _ => {} } @@ -182,10 +196,10 @@ pub fn pat_contains_bindings_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool { contains_bindings } -pub fn simple_identifier<'a>(pat: &'a hir::Pat) -> Option<&'a ast::Ident> { +pub fn simple_name<'a>(pat: &'a hir::Pat) -> Option { match pat.node { hir::PatIdent(hir::BindByValue(_), ref path1, None) => { - Some(&path1.node) + Some(path1.node.name) } _ => { None diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index c21999c2dbc32..6fbdd90217658 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -73,7 +73,7 @@ struct LifetimeContext<'a> { trait_ref_hack: bool, // List of labels in the function/method currently under analysis. - labels_in_fn: Vec<(ast::Ident, Span)>, + labels_in_fn: Vec<(ast::Name, Span)>, } enum ScopeChain<'a> { @@ -381,7 +381,7 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v hir::Block) { struct GatherLabels<'a> { sess: &'a Session, scope: Scope<'a>, - labels_in_fn: &'a mut Vec<(ast::Ident, Span)>, + labels_in_fn: &'a mut Vec<(ast::Name, Span)>, } let mut gather = GatherLabels { @@ -403,9 +403,9 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v hir::Block) { if let Some(label) = expression_label(ex) { for &(prior, prior_span) in &self.labels_in_fn[..] { // FIXME (#24278): non-hygienic comparison - if label.name == prior.name { + if label == prior { signal_shadowing_problem(self.sess, - label.name, + label, original_label(prior_span), shadower_label(ex.span)); } @@ -426,17 +426,17 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v hir::Block) { } } - fn expression_label(ex: &hir::Expr) -> Option { + fn expression_label(ex: &hir::Expr) -> Option { match ex.node { hir::ExprWhile(_, _, Some(label)) | - hir::ExprLoop(_, Some(label)) => Some(label), + hir::ExprLoop(_, Some(label)) => Some(label.name), _ => None, } } fn check_if_label_shadows_lifetime<'a>(sess: &'a Session, mut scope: Scope<'a>, - label: ast::Ident, + label: ast::Name, label_span: Span) { loop { match *scope { @@ -447,10 +447,10 @@ fn extract_labels<'v, 'a>(ctxt: &mut LifetimeContext<'a>, b: &'v hir::Block) { LateScope(lifetimes, s) => { for lifetime_def in lifetimes { // FIXME (#24278): non-hygienic comparison - if label.name == lifetime_def.lifetime.name { + if label == lifetime_def.lifetime.name { signal_shadowing_problem( sess, - label.name, + label, original_lifetime(&lifetime_def.lifetime), shadower_label(label_span)); return; @@ -703,7 +703,7 @@ impl<'a> LifetimeContext<'a> { { for &(label, label_span) in &self.labels_in_fn { // FIXME (#24278): non-hygienic comparison - if lifetime.name == label.name { + if lifetime.name == label { signal_shadowing_problem(self.sess, lifetime.name, original_label(label_span), diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 3515b53b00d31..83fac73b7f9df 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -99,7 +99,7 @@ pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let pat_span_path_opt = match move_pat.node { hir::PatIdent(_, ref path1, _) => { Some(MoveSpanAndPath{span: move_pat.span, - ident: path1.node}) + name: path1.node.name}) }, _ => None, }; diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs index bbcf51933422e..0091bbb9395ab 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs @@ -57,7 +57,7 @@ impl<'tcx> MoveError<'tcx> { #[derive(Clone)] pub struct MoveSpanAndPath { pub span: codemap::Span, - pub ident: ast::Ident + pub name: ast::Name, } pub struct GroupedMoveErrors<'tcx> { @@ -73,7 +73,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let mut is_first_note = true; for move_to in &error.move_to_places { note_move_destination(bccx, move_to.span, - &move_to.ident, is_first_note); + move_to.name, is_first_note); is_first_note = false; } } @@ -157,9 +157,9 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, fn note_move_destination(bccx: &BorrowckCtxt, move_to_span: codemap::Span, - pat_ident: &ast::Ident, + pat_name: ast::Name, is_first_note: bool) { - let pat_name = pprust::ident_to_string(pat_ident); + let pat_name = pprust::name_to_string(pat_name); if is_first_note { bccx.span_note( move_to_span, diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 75b57341d48df..5f5736275034b 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -330,8 +330,7 @@ impl<'ast> pprust_hir::PpAnn for IdentifiedAnnotation<'ast> { s: &mut pprust_hir::State, node: pprust_hir::AnnNode) -> io::Result<()> { match node { - pprust_hir::NodeIdent(_) | pprust_hir::NodeName(_) => Ok(()), - + pprust_hir::NodeName(_) => Ok(()), pprust_hir::NodeItem(item) => { try!(pp::space(&mut s.s)); s.synth_comment(item.id.to_string()) diff --git a/src/librustc_front/fold.rs b/src/librustc_front/fold.rs index 8ef0b5e6648b9..29acfc4c4a2d9 100644 --- a/src/librustc_front/fold.rs +++ b/src/librustc_front/fold.rs @@ -296,8 +296,8 @@ pub fn noop_fold_meta_items(meta_items: Vec>, fld: &mut T pub fn noop_fold_view_path(view_path: P, fld: &mut T) -> P { view_path.map(|Spanned {node, span}| Spanned { node: match node { - ViewPathSimple(ident, path) => { - ViewPathSimple(ident, fld.fold_path(path)) + ViewPathSimple(name, path) => { + ViewPathSimple(name, fld.fold_path(path)) } ViewPathGlob(path) => { ViewPathGlob(fld.fold_path(path)) @@ -520,11 +520,11 @@ pub fn noop_fold_explicit_self_underscore(es: ExplicitSelf_, fld: &mu -> ExplicitSelf_ { match es { SelfStatic | SelfValue(_) => es, - SelfRegion(lifetime, m, ident) => { - SelfRegion(fld.fold_opt_lifetime(lifetime), m, ident) + SelfRegion(lifetime, m, name) => { + SelfRegion(fld.fold_opt_lifetime(lifetime), m, name) } - SelfExplicit(typ, ident) => { - SelfExplicit(fld.fold_ty(typ), ident) + SelfExplicit(typ, name) => { + SelfExplicit(fld.fold_ty(typ), name) } } } @@ -1111,10 +1111,10 @@ pub fn noop_fold_expr(Expr {id, node, span}: Expr, folder: &mut T) -> respan(folder.new_span(name.span), folder.fold_name(name.node))) } - ExprTupField(el, ident) => { + ExprTupField(el, index) => { ExprTupField(folder.fold_expr(el), - respan(folder.new_span(ident.span), - folder.fold_usize(ident.node))) + respan(folder.new_span(index.span), + folder.fold_usize(index.node))) } ExprIndex(el, er) => { ExprIndex(folder.fold_expr(el), folder.fold_expr(er)) diff --git a/src/librustc_front/print/pprust.rs b/src/librustc_front/print/pprust.rs index 6f2ef8e8cbc48..9659c9df366c7 100644 --- a/src/librustc_front/print/pprust.rs +++ b/src/librustc_front/print/pprust.rs @@ -30,7 +30,6 @@ use hir::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; use std::io::{self, Write, Read}; pub enum AnnNode<'a> { - NodeIdent(&'a ast::Ident), NodeName(&'a ast::Name), NodeBlock(&'a hir::Block), NodeItem(&'a hir::Item), @@ -264,8 +263,8 @@ pub fn path_to_string(p: &hir::Path) -> String { to_string(|s| s.print_path(p, false, 0)) } -pub fn ident_to_string(id: &ast::Ident) -> String { - to_string(|s| s.print_ident(*id)) +pub fn name_to_string(name: ast::Name) -> String { + to_string(|s| s.print_name(name)) } pub fn fun_to_string(decl: &hir::FnDecl, @@ -1355,7 +1354,7 @@ impl<'a> State<'a> { } hir::ExprWhile(ref test, ref blk, opt_ident) => { if let Some(ident) = opt_ident { - try!(self.print_ident(ident)); + try!(self.print_name(ident.name)); try!(self.word_space(":")); } try!(self.head("while")); @@ -1365,7 +1364,7 @@ impl<'a> State<'a> { } hir::ExprLoop(ref blk, opt_ident) => { if let Some(ident) = opt_ident { - try!(self.print_ident(ident)); + try!(self.print_name(ident.name)); try!(self.word_space(":")); } try!(self.head("loop")); @@ -1470,7 +1469,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "break")); try!(space(&mut self.s)); if let Some(ident) = opt_ident { - try!(self.print_ident(ident.node)); + try!(self.print_name(ident.node.name)); try!(space(&mut self.s)); } } @@ -1478,7 +1477,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "continue")); try!(space(&mut self.s)); if let Some(ident) = opt_ident { - try!(self.print_ident(ident.node)); + try!(self.print_name(ident.node.name)); try!(space(&mut self.s)) } } @@ -1591,11 +1590,6 @@ impl<'a> State<'a> { } } - pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> { - try!(word(&mut self.s, &ident.name.as_str())); - self.ann.post(self, NodeIdent(&ident)) - } - pub fn print_usize(&mut self, i: usize) -> io::Result<()> { word(&mut self.s, &i.to_string()) } @@ -1629,7 +1623,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "::")) } - try!(self.print_ident(segment.identifier)); + try!(self.print_name(segment.identifier.name)); try!(self.print_path_parameters(&segment.parameters, colons_before_params)); } @@ -1654,7 +1648,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, ">")); try!(word(&mut self.s, "::")); let item_segment = path.segments.last().unwrap(); - try!(self.print_ident(item_segment.identifier)); + try!(self.print_name(item_segment.identifier.name)); self.print_path_parameters(&item_segment.parameters, colons_before_params) } @@ -1750,7 +1744,7 @@ impl<'a> State<'a> { try!(self.word_nbsp("mut")); } } - try!(self.print_ident(path1.node)); + try!(self.print_name(path1.node.name)); match *sub { Some(ref p) => { try!(word(&mut self.s, "@")); @@ -2192,14 +2186,14 @@ impl<'a> State<'a> { word(&mut self.s, "::*") } - hir::ViewPathList(ref path, ref idents) => { + hir::ViewPathList(ref path, ref segments) => { if path.segments.is_empty() { try!(word(&mut self.s, "{")); } else { try!(self.print_path(path, false, 0)); try!(word(&mut self.s, "::{")); } - try!(self.commasep(Inconsistent, &idents[..], |s, w| { + try!(self.commasep(Inconsistent, &segments[..], |s, w| { match w.node { hir::PathListIdent { name, .. } => { s.print_name(name) @@ -2277,7 +2271,7 @@ impl<'a> State<'a> { abi: abi::Abi, unsafety: hir::Unsafety, decl: &hir::FnDecl, - name: Option, + name: Option, generics: &hir::Generics, opt_explicit_self: Option<&hir::ExplicitSelf_>) -> io::Result<()> { @@ -2298,7 +2292,7 @@ impl<'a> State<'a> { unsafety, hir::Constness::NotConst, abi, - name.map(|x| x.name), + name, &generics, opt_explicit_self, hir::Inherited)); diff --git a/src/librustc_front/util.rs b/src/librustc_front/util.rs index 00abb14d40ff8..6e202ecad366e 100644 --- a/src/librustc_front/util.rs +++ b/src/librustc_front/util.rs @@ -355,13 +355,13 @@ pub fn empty_generics() -> Generics { // convert a span and an identifier to the corresponding // 1-segment path -pub fn ident_to_path(s: Span, identifier: Ident) -> Path { +pub fn ident_to_path(s: Span, ident: Ident) -> Path { hir::Path { span: s, global: false, segments: vec!( hir::PathSegment { - identifier: identifier, + identifier: ident, parameters: hir::AngleBracketedParameters(hir::AngleBracketedParameterData { lifetimes: Vec::new(), types: OwnedSlice::empty(), diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 111913adb8aa8..d12cd082cab7e 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -761,9 +761,6 @@ impl LintPass for UnconditionalRecursion { impl LateLintPass for UnconditionalRecursion { fn check_fn(&mut self, cx: &LateContext, fn_kind: FnKind, _: &hir::FnDecl, blk: &hir::Block, sp: Span, id: ast::NodeId) { - type F = for<'tcx> fn(&ty::ctxt<'tcx>, - ast::NodeId, ast::NodeId, ast::Ident, ast::NodeId) -> bool; - let method = match fn_kind { FnKind::ItemFn(..) => None, FnKind::Method(..) => { diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 6df32f53d8130..7972bbda02b0a 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -47,10 +47,10 @@ impl UnusedMut { let mut mutables = FnvHashMap(); for p in pats { pat_util::pat_bindings(&cx.tcx.def_map, p, |mode, id, _, path1| { - let ident = path1.node; + let name = path1.node; if let hir::BindByValue(hir::MutMutable) = mode { - if !ident.name.as_str().starts_with("_") { - match mutables.entry(ident.name.usize()) { + if !name.as_str().starts_with("_") { + match mutables.entry(name.usize()) { Vacant(entry) => { entry.insert(vec![id]); }, Occupied(mut entry) => { entry.get_mut().push(id); }, } diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 7f0b3ee3b316b..2ff57a187123d 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -199,7 +199,7 @@ struct Candidate { struct Binding { span: H::Span, source: Lvalue, - name: H::Ident, + name: H::Name, var_id: H::VarId, var_ty: H::Ty, mutability: Mutability, @@ -376,7 +376,7 @@ impl Builder { fn declare_binding(&mut self, var_extent: H::CodeExtent, mutability: Mutability, - name: H::Ident, + name: H::Name, var_id: H::VarId, var_ty: H::Ty, span: H::Span) diff --git a/src/librustc_mir/hair.rs b/src/librustc_mir/hair.rs index f1450522dd83e..49e1e981a488d 100644 --- a/src/librustc_mir/hair.rs +++ b/src/librustc_mir/hair.rs @@ -29,7 +29,6 @@ pub trait Hair: Sized+Debug+Clone+Eq+Hash { // (*) type DefId: Copy+Debug+Eq+Hash; // e.g., DefId type AdtDef: Copy+Debug+Eq+Hash; // e.g., AdtDef<'tcx> type Name: Copy+Debug+Eq+Hash; // e.g., ast::Name - type Ident: Copy+Debug+Eq+Hash; // e.g., ast::Ident type InternedString: Clone+Debug+Eq+Hash; // e.g., InternedString type Bytes: Clone+Debug+Eq+Hash; // e.g., Rc> type Span: Copy+Debug+Eq; // e.g., syntax::codemap::Span @@ -248,7 +247,7 @@ pub enum PatternKind { // x, ref x, x @ P, etc Binding { mutability: Mutability, - name: H::Ident, + name: H::Name, mode: BindingMode, var: H::VarId, ty: H::Ty, diff --git a/src/librustc_mir/repr.rs b/src/librustc_mir/repr.rs index a54942144c5ec..a1b891ab09086 100644 --- a/src/librustc_mir/repr.rs +++ b/src/librustc_mir/repr.rs @@ -113,7 +113,7 @@ pub enum BorrowKind { // decl, a let, etc. pub struct VarDecl { pub mutability: Mutability, - pub name: H::Ident, + pub name: H::Name, pub ty: H::Ty, } diff --git a/src/librustc_mir/tcx/expr.rs b/src/librustc_mir/tcx/expr.rs index 78f23fcd71ceb..33982b3e56850 100644 --- a/src/librustc_mir/tcx/expr.rs +++ b/src/librustc_mir/tcx/expr.rs @@ -291,9 +291,9 @@ impl<'a,'tcx:'a> Mirror> for &'tcx hir::Expr { hir::ExprField(ref source, name) => ExprKind::Field { lhs: source.to_ref(), name: Field::Named(name.node) }, - hir::ExprTupField(ref source, ident) => + hir::ExprTupField(ref source, index) => ExprKind::Field { lhs: source.to_ref(), - name: Field::Indexed(ident.node) }, + name: Field::Indexed(index.node) }, hir::ExprCast(ref source, _) => ExprKind::Cast { source: source.to_ref() }, hir::ExprBox(ref place, ref value) => diff --git a/src/librustc_mir/tcx/mod.rs b/src/librustc_mir/tcx/mod.rs index 2e9eae0956d96..9c0ef55b3d83a 100644 --- a/src/librustc_mir/tcx/mod.rs +++ b/src/librustc_mir/tcx/mod.rs @@ -47,7 +47,6 @@ impl<'a,'tcx:'a> Hair for Cx<'a, 'tcx> { type DefId = DefId; type AdtDef = ty::AdtDef<'tcx>; type Name = ast::Name; - type Ident = ast::Ident; type InternedString = InternedString; type Bytes = Rc>; type Span = Span; diff --git a/src/librustc_mir/tcx/pattern.rs b/src/librustc_mir/tcx/pattern.rs index aeca15cb43c36..d80fbfa7fe897 100644 --- a/src/librustc_mir/tcx/pattern.rs +++ b/src/librustc_mir/tcx/pattern.rs @@ -39,12 +39,12 @@ use tcx::to_ref::ToRef; #[derive(Clone, Debug)] pub struct PatNode<'tcx> { pat: &'tcx hir::Pat, - binding_map: Option>> + binding_map: Option>> } impl<'tcx> PatNode<'tcx> { pub fn new(pat: &'tcx hir::Pat, - binding_map: Option>>) + binding_map: Option>>) -> PatNode<'tcx> { PatNode { pat: pat, @@ -220,7 +220,7 @@ impl<'a,'tcx:'a> Mirror> for PatNode<'tcx> { { let id = match self.binding_map { None => self.pat.id, - Some(ref map) => map[&ident.node], + Some(ref map) => map[&ident.node.name], }; let var_ty = cx.tcx.node_id_to_type(self.pat.id); let region = match var_ty.sty { @@ -240,7 +240,7 @@ impl<'a,'tcx:'a> Mirror> for PatNode<'tcx> { PatternKind::Binding { mutability: mutability, mode: mode, - name: ident.node, + name: ident.node.name, var: id, ty: var_ty, subpattern: self.opt_pat_ref(sub), diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index ce1b9663520fc..cf964107d16b3 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -392,7 +392,6 @@ enum PrivacyResult { enum FieldName { UnnamedField(usize), // index - // (Name, not Ident, because struct fields are not macro-hygienic) NamedField(ast::Name), } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index e3e1a26a6f6eb..8a15eabd61419 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -281,14 +281,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { ViewPathSimple(_, ref full_path) => { full_path.segments .split_last().unwrap().1 - .iter().map(|ident| ident.identifier.name) + .iter().map(|seg| seg.identifier.name) .collect() } ViewPathGlob(ref module_ident_path) | ViewPathList(ref module_ident_path, _) => { module_ident_path.segments - .iter().map(|ident| ident.identifier.name).collect() + .iter().map(|seg| seg.identifier.name).collect() } }; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index f3789c773fb2d..e869fb9c2bc7b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -57,7 +57,7 @@ use rustc::metadata::csearch; use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl}; use rustc::middle::def::*; use rustc::middle::def_id::DefId; -use rustc::middle::pat_util::pat_bindings; +use rustc::middle::pat_util::pat_bindings_hygienic; use rustc::middle::privacy::*; use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace}; use rustc::middle::ty::{Freevar, FreevarMap, TraitMap, GlobMap}; @@ -2559,7 +2559,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // user and one 'x' came from the macro. fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap { let mut result = HashMap::new(); - pat_bindings(&self.def_map, pat, |binding_mode, _id, sp, path1| { + pat_bindings_hygienic(&self.def_map, pat, |binding_mode, _id, sp, path1| { let name = mtwt::resolve(path1.node); result.insert(name, BindingInfo { span: sp, diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 3c2612a134855..c84f92864011f 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -793,10 +793,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { ))); } - for (ident, target_import_resolution) in import_resolutions.iter() { + for (name, target_import_resolution) in import_resolutions.iter() { debug!("(resolving glob import) writing module resolution \ {} into `{}`", - *ident, + *name, module_to_string(module_)); if !target_import_resolution.is_public { @@ -806,7 +806,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { // Here we merge two import resolutions. let mut import_resolutions = module_.import_resolutions.borrow_mut(); - match import_resolutions.get_mut(ident) { + match import_resolutions.get_mut(name) { Some(dest_import_resolution) => { // Merge the two import resolutions at a finer-grained // level. @@ -818,7 +818,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { Some(ref value_target) => { self.check_for_conflicting_import(&dest_import_resolution, import_directive.span, - *ident, + *name, ValueNS); dest_import_resolution.value_target = Some(value_target.clone()); } @@ -830,7 +830,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { Some(ref type_target) => { self.check_for_conflicting_import(&dest_import_resolution, import_directive.span, - *ident, + *name, TypeNS); dest_import_resolution.type_target = Some(type_target.clone()); } @@ -848,7 +848,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { new_import_resolution.type_target = target_import_resolution.type_target.clone(); - import_resolutions.insert(*ident, new_import_resolution); + import_resolutions.insert(*name, new_import_resolution); } // Add all children from the containing module. diff --git a/src/librustc_trans/save/dump_csv.rs b/src/librustc_trans/save/dump_csv.rs index 9f50e7a1e6d9a..df2290671ae34 100644 --- a/src/librustc_trans/save/dump_csv.rs +++ b/src/librustc_trans/save/dump_csv.rs @@ -444,7 +444,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> { fn process_const(&mut self, id: ast::NodeId, - ident: &ast::Ident, + name: &ast::Name, span: Span, typ: &ast::Ty, expr: &ast::Expr) { @@ -456,7 +456,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> { self.fmt.static_str(span, sub_span, id, - &ident.name.as_str(), + &name.as_str(), &qualname, &self.span.snippet(expr.span), &ty_to_string(&*typ), @@ -988,7 +988,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> { fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) { match trait_item.node { ast::ConstTraitItem(ref ty, Some(ref expr)) => { - self.process_const(trait_item.id, &trait_item.ident, + self.process_const(trait_item.id, &trait_item.ident.name, trait_item.span, &*ty, &*expr); } ast::MethodTraitItem(ref sig, ref body) => { @@ -1006,7 +1006,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> { fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) { match impl_item.node { ast::ConstImplItem(ref ty, ref expr) => { - self.process_const(impl_item.id, &impl_item.ident, + self.process_const(impl_item.id, &impl_item.ident.name, impl_item.span, &ty, &expr); } ast::MethodImplItem(ref sig, ref body) => { diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index af0780587e8b0..cdc102b2e7a09 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -375,7 +375,7 @@ pub struct BindingInfo<'tcx> { pub ty: Ty<'tcx>, } -type BindingsMap<'tcx> = FnvHashMap>; +type BindingsMap<'tcx> = FnvHashMap>; struct ArmData<'p, 'blk, 'tcx: 'blk> { bodycx: Block<'blk, 'tcx>, @@ -390,7 +390,7 @@ struct ArmData<'p, 'blk, 'tcx: 'blk> { struct Match<'a, 'p: 'a, 'blk: 'a, 'tcx: 'blk> { pats: Vec<&'p hir::Pat>, data: &'a ArmData<'p, 'blk, 'tcx>, - bound_ptrs: Vec<(ast::Ident, ValueRef)>, + bound_ptrs: Vec<(ast::Name, ValueRef)>, // Thread along renamings done by the check_match::StaticInliner, so we can // map back to original NodeIds pat_renaming_map: Option<&'a FnvHashMap<(NodeId, Span), NodeId>> @@ -464,7 +464,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>, loop { pat = match pat.node { hir::PatIdent(_, ref path, Some(ref inner)) => { - bound_ptrs.push((path.node, val.val)); + bound_ptrs.push((path.node.name, val.val)); &**inner }, _ => break @@ -505,7 +505,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>, match this.node { hir::PatIdent(_, ref path, None) => { if pat_is_binding(dm, &*this) { - bound_ptrs.push((path.node, val.val)); + bound_ptrs.push((path.node.name, val.val)); } } hir::PatVec(ref before, Some(ref slice), ref after) => { @@ -513,7 +513,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>, let subslice_val = bind_subslice_pat( bcx, this.id, val, before.len(), after.len()); - bound_ptrs.push((path.node, subslice_val)); + bound_ptrs.push((path.node.name, subslice_val)); } } _ => {} @@ -943,7 +943,7 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, bindings_map: &BindingsMap<'tcx>, cs: Option) -> Block<'blk, 'tcx> { - for (&ident, &binding_info) in bindings_map { + for (&name, &binding_info) in bindings_map { let (llval, aliases_other_state) = match binding_info.trmode { // By value mut binding for a copy type: load from the ptr // into the matched value and copy to our alloca @@ -1021,7 +1021,7 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, debug!("binding {} to {}", binding_info.id, bcx.val_to_string(llval)); bcx.fcx.lllocals.borrow_mut().insert(binding_info.id, datum); - debuginfo::create_match_binding_metadata(bcx, ident.name, binding_info); + debuginfo::create_match_binding_metadata(bcx, name, binding_info); } bcx } @@ -1510,8 +1510,7 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &hir::Pat, let reassigned = is_discr_reassigned(bcx, discr, body); let mut bindings_map = FnvHashMap(); pat_bindings(&tcx.def_map, &*pat, |bm, p_id, span, path1| { - let ident = path1.node; - let name = ident.name; + let name = path1.node; let variable_ty = node_id_type(bcx, p_id); let llvariable_ty = type_of::type_of(ccx, variable_ty); let tcx = bcx.tcx(); @@ -1543,7 +1542,7 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &hir::Pat, trmode = TrByRef; } }; - bindings_map.insert(ident, BindingInfo { + bindings_map.insert(name, BindingInfo { llmatch: llmatch, trmode: trmode, id: p_id, @@ -1656,7 +1655,7 @@ pub fn store_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat_bindings(&tcx.def_map, pat, |_, p_id, _, path1| { let scope = cleanup::var_scope(tcx, p_id); bcx = mk_binding_alloca( - bcx, p_id, path1.node.name, scope, (), + bcx, p_id, path1.node, scope, (), "_match::store_local::create_dummy_locals", |(), bcx, Datum { val: llval, ty, kind }| { // Dummy-locals start out uninitialized, so set their @@ -1693,11 +1692,11 @@ pub fn store_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // // In such cases, the more general path is unsafe, because // it assumes it is matching against a valid value. - match simple_identifier(&*pat) { - Some(ident) => { + match simple_name(pat) { + Some(name) => { let var_scope = cleanup::var_scope(tcx, local.id); return mk_binding_alloca( - bcx, pat.id, ident.name, var_scope, (), + bcx, pat.id, name, var_scope, (), "_match::store_local", |(), bcx, Datum { val: v, .. }| expr::trans_into(bcx, &**init_expr, expr::SaveIn(v))); diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index dd0c06c9142e6..894e0af9cce6b 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -40,7 +40,7 @@ use middle::cfg; use middle::def_id::{DefId, LOCAL_CRATE}; use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem}; use middle::weak_lang_items; -use middle::pat_util::simple_identifier; +use middle::pat_util::simple_name; use middle::subst::Substs; use middle::ty::{self, Ty, HasTypeFlags}; use rustc::front::map as hir_map; @@ -1447,10 +1447,10 @@ pub fn create_datums_for_fn_args<'a, 'tcx>(mut bcx: Block<'a, 'tcx>, }; let pat = &*args[i].pat; - bcx = if let Some(ident) = simple_identifier(&*pat) { + bcx = if let Some(name) = simple_name(pat) { // Generate nicer LLVM for the common case of fn a pattern // like `x: T` - set_value_name(arg_datum.val, &bcx.name(ident.name)); + set_value_name(arg_datum.val, &bcx.name(name)); bcx.fcx.lllocals.borrow_mut().insert(pat.id, arg_datum); bcx } else { diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/trans/controlflow.rs index 340eabf77daec..875eb353cf7e3 100644 --- a/src/librustc_trans/trans/controlflow.rs +++ b/src/librustc_trans/trans/controlflow.rs @@ -305,7 +305,7 @@ pub fn trans_loop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn trans_break_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &hir::Expr, - opt_label: Option, + opt_label: Option, exit: usize) -> Block<'blk, 'tcx> { let _icx = push_ctxt("trans_break_cont"); @@ -338,14 +338,14 @@ pub fn trans_break_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn trans_break<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &hir::Expr, - label_opt: Option) + label_opt: Option) -> Block<'blk, 'tcx> { return trans_break_cont(bcx, expr, label_opt, cleanup::EXIT_BREAK); } pub fn trans_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &hir::Expr, - label_opt: Option) + label_opt: Option) -> Block<'blk, 'tcx> { return trans_break_cont(bcx, expr, label_opt, cleanup::EXIT_LOOP); } diff --git a/src/librustc_trans/trans/debuginfo/create_scope_map.rs b/src/librustc_trans/trans/debuginfo/create_scope_map.rs index 828086800499a..8be108441ec17 100644 --- a/src/librustc_trans/trans/debuginfo/create_scope_map.rs +++ b/src/librustc_trans/trans/debuginfo/create_scope_map.rs @@ -49,7 +49,7 @@ pub fn create_scope_map(cx: &CrateContext, for arg in args { pat_util::pat_bindings(def_map, &*arg.pat, |_, node_id, _, path1| { scope_stack.push(ScopeStackEntry { scope_metadata: fn_metadata, - name: Some(path1.node.name) }); + name: Some(path1.node) }); scope_map.insert(node_id, fn_metadata); }) } diff --git a/src/librustc_trans/trans/debuginfo/metadata.rs b/src/librustc_trans/trans/debuginfo/metadata.rs index fa2c476f6133b..1d35b51a5f81c 100644 --- a/src/librustc_trans/trans/debuginfo/metadata.rs +++ b/src/librustc_trans/trans/debuginfo/metadata.rs @@ -1925,7 +1925,7 @@ pub fn create_local_var_metadata(bcx: Block, local: &hir::Local) { let def_map = &cx.tcx().def_map; let locals = bcx.fcx.lllocals.borrow(); - pat_util::pat_bindings(def_map, &*local.pat, |_, node_id, span, var_ident| { + pat_util::pat_bindings(def_map, &*local.pat, |_, node_id, span, var_name| { let datum = match locals.get(&node_id) { Some(datum) => datum, None => { @@ -1943,7 +1943,7 @@ pub fn create_local_var_metadata(bcx: Block, local: &hir::Local) { let scope_metadata = scope_metadata(bcx.fcx, node_id, span); declare_local(bcx, - var_ident.node.name, + var_name.node, datum.ty, scope_metadata, VariableAccess::DirectVariable { alloca: datum.val }, @@ -2105,7 +2105,7 @@ pub fn create_argument_metadata(bcx: Block, arg: &hir::Arg) { .fn_metadata; let locals = bcx.fcx.lllocals.borrow(); - pat_util::pat_bindings(def_map, &*arg.pat, |_, node_id, span, var_ident| { + pat_util::pat_bindings(def_map, &*arg.pat, |_, node_id, span, var_name| { let datum = match locals.get(&node_id) { Some(v) => v, None => { @@ -2132,7 +2132,7 @@ pub fn create_argument_metadata(bcx: Block, arg: &hir::Arg) { }; declare_local(bcx, - var_ident.node.name, + var_name.node, datum.ty, scope_metadata, VariableAccess::DirectVariable { alloca: datum.val }, diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index f2dcf84d41920..c081f4fdb4775 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -963,10 +963,10 @@ fn trans_rvalue_stmt_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, match expr.node { hir::ExprBreak(label_opt) => { - controlflow::trans_break(bcx, expr, label_opt.map(|l| l.node)) + controlflow::trans_break(bcx, expr, label_opt.map(|l| l.node.name)) } hir::ExprAgain(label_opt) => { - controlflow::trans_cont(bcx, expr, label_opt.map(|l| l.node)) + controlflow::trans_cont(bcx, expr, label_opt.map(|l| l.node.name)) } hir::ExprRet(ref ex) => { // Check to see if the return expression itself is reachable. @@ -1114,7 +1114,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // trans. Shudder. fn make_field(field_name: &str, expr: P) -> hir::Field { hir::Field { - name: codemap::dummy_spanned(token::str_to_ident(field_name).name), + name: codemap::dummy_spanned(token::intern(field_name)), expr: expr, span: codemap::DUMMY_SP, } diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 136b3c4405d5b..546e337d746d9 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -179,7 +179,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, // if there are multiple arms, make sure they all agree on // what the type of the binding `x` ought to be - let canon_id = *pcx.map.get(&path.node).unwrap(); + let canon_id = *pcx.map.get(&path.node.name).unwrap(); if canon_id != pat.id { let ct = fcx.local_ty(pat.span, canon_id); demand::eqtype(fcx, pat.span, ct, typ); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 47ddbfdb8cc3c..9b8f90e97e014 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -682,7 +682,7 @@ pub fn check_struct(ccx: &CrateCtxt, id: ast::NodeId, span: Span) { } pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) { - debug!("check_item_type(it.id={}, it.ident={})", + debug!("check_item_type(it.id={}, it.name={})", it.id, ccx.tcx.item_path_str(DefId::local(it.id))); let _indenter = indenter(); @@ -750,7 +750,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) { } pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) { - debug!("check_item_body(it.id={}, it.ident={})", + debug!("check_item_body(it.id={}, it.name={})", it.id, ccx.tcx.item_path_str(DefId::local(it.id))); let _indenter = indenter(); diff --git a/src/librustc_typeck/check/wf.rs b/src/librustc_typeck/check/wf.rs index 902ebcc3da87b..70983b89ed5c8 100644 --- a/src/librustc_typeck/check/wf.rs +++ b/src/librustc_typeck/check/wf.rs @@ -55,7 +55,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> { /// the types first. fn check_item_well_formed(&mut self, item: &hir::Item) { let ccx = self.ccx; - debug!("check_item_well_formed(it.id={}, it.ident={})", + debug!("check_item_well_formed(it.id={}, it.name={})", item.id, ccx.tcx.item_path_str(DefId::local(item.id))); diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 0e462b2a8525d..2c6879891b1c9 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -61,7 +61,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> { /// the types first. fn check_item_well_formed(&mut self, item: &hir::Item) { let ccx = self.ccx; - debug!("check_item_well_formed(it.id={}, it.ident={})", + debug!("check_item_well_formed(it.id={}, it.name={})", item.id, ccx.tcx.item_path_str(DefId::local(item.id))); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index cd3c630c7abb5..9e1b20258f07b 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -699,12 +699,12 @@ fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>, rcvr_ty_generics, rcvr_ty_predicates); - for (sig, id, ident, vis, _span) in methods { + for (sig, id, name, vis, _span) in methods { convert_method(ccx, container, sig, id, - ident, + name, vis, untransformed_rcvr_ty, rcvr_ty_generics, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 14d5ed2eb507d..89020b011a955 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1583,7 +1583,7 @@ impl Clean for hir::Ty { let mut trait_path = p.clone(); trait_path.segments.pop(); Type::QPath { - name: p.segments.last().unwrap().identifier.clean(cx), + name: p.segments.last().unwrap().identifier.name.clean(cx), self_type: box qself.ty.clean(cx), trait_: box resolve_type(cx, trait_path.clean(cx), self.id) } @@ -2044,7 +2044,7 @@ pub struct PathSegment { impl Clean for hir::PathSegment { fn clean(&self, cx: &DocContext) -> PathSegment { PathSegment { - name: self.identifier.clean(cx), + name: self.identifier.name.clean(cx), params: self.parameters.clean(cx) } } @@ -2064,12 +2064,6 @@ fn path_to_string(p: &hir::Path) -> String { s } -impl Clean for ast::Ident { - fn clean(&self, _: &DocContext) -> String { - self.to_string() - } -} - impl Clean for ast::Name { fn clean(&self, _: &DocContext) -> String { self.to_string() diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs index b6400c68f5367..5b4b4e4ef2c00 100644 --- a/src/test/run-pass/backtrace-debuginfo.rs +++ b/src/test/run-pass/backtrace-debuginfo.rs @@ -16,6 +16,7 @@ // "enable" to 0 instead. // compile-flags:-g -Cllvm-args=-enable-tail-merge=0 // ignore-pretty as this critically relies on line numbers +// ignore-windows use std::io; use std::io::prelude::*; diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index 5d65f9eb2be0f..40aed16bd138e 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -11,6 +11,7 @@ // no-pretty-expanded FIXME #15189 // ignore-android FIXME #17520 // ignore-msvc FIXME #28133 +// ignore-windows use std::env; use std::process::{Command, Stdio};