// don't suggest placing a use before the prelude
// import or other generated ones
if item.span == DUMMY_SP {
- let mut span = item.span;
- span.hi = span.lo;
- self.span = Some(span);
+ self.span = Some(item.span.with_hi(item.span.lo()));
self.found_use = true;
return;
}
ItemKind::ExternCrate(_) => {}
// but place them before the first other item
_ => if self.span.map_or(true, |span| item.span < span ) {
- let mut span = item.span;
- span.hi = span.lo;
- self.span = Some(span);
+ self.span = Some(item.span.with_hi(item.span.lo()));
},
}
}
def_map: NodeMap(),
freevars: NodeMap(),
freevars_seen: NodeMap(),
- export_map: NodeMap(),
+ export_map: FxHashMap(),
trait_map: NodeMap(),
module_map,
block_map: NodeMap(),
fn resolve_self(&mut self, ctxt: &mut SyntaxContext, module: Module<'a>) -> Module<'a> {
let mut module = self.get_module(module.normal_ancestor_id);
- while module.span.ctxt.modern() != *ctxt {
+ while module.span.ctxt().modern() != *ctxt {
let parent = module.parent.unwrap_or_else(|| self.macro_def_scope(ctxt.remove_mark()));
module = self.get_module(parent.normal_ancestor_id);
}
// must not add it if it's in the bindings map
// because that breaks the assumptions later
// passes make about or-patterns.)
- let mut def = Def::Local(self.definitions.local_def_id(pat_id));
+ let mut def = Def::Local(pat_id);
match bindings.get(&ident.node).cloned() {
Some(id) if id == outer_pat_id => {
// `Variant(a, a)`, error
sp = sp.next_point();
if let Ok(snippet) = cm.span_to_snippet(sp.to(sp.next_point())) {
debug!("snippet {:?}", snippet);
- let line_sp = cm.lookup_char_pos(sp.hi).line;
- let line_base_sp = cm.lookup_char_pos(base_span.lo).line;
+ let line_sp = cm.lookup_char_pos(sp.hi()).line;
+ let line_base_sp = cm.lookup_char_pos(base_span.lo()).line;
debug!("{:?} {:?}", line_sp, line_base_sp);
if snippet == ":" {
err.span_label(base_span,
Def::Upvar(..) => {
span_bug!(span, "unexpected {:?} in bindings", def)
}
- Def::Local(def_id) => {
+ Def::Local(node_id) => {
for rib in ribs {
match rib.kind {
NormalRibKind | ModuleRibKind(..) | MacroDefinition(..) |
}
ClosureRibKind(function_id) => {
let prev_def = def;
- let node_id = self.definitions.as_local_node_id(def_id).unwrap();
let seen = self.freevars_seen
.entry(function_id)
.or_insert_with(|| NodeMap());
if let Some(&index) = seen.get(&node_id) {
- def = Def::Upvar(def_id, index, function_id);
+ def = Def::Upvar(node_id, index, function_id);
continue;
}
let vec = self.freevars
.entry(function_id)
.or_insert_with(|| vec![]);
let depth = vec.len();
- def = Def::Upvar(def_id, depth, function_id);
+ def = Def::Upvar(node_id, depth, function_id);
if record_used {
vec.push(Freevar {
}
// Fields are generally expected in the same contexts as locals.
- if filter_fn(Def::Local(DefId::local(CRATE_DEF_INDEX))) {
+ if filter_fn(Def::Local(ast::DUMMY_NODE_ID)) {
if let Some(node_id) = self.current_self_type.as_ref().and_then(extract_node_id) {
// Look for a field with the same name in the current self_type.
if let Some(resolution) = self.def_map.get(&node_id) {
for &(trait_name, binding) in traits.as_ref().unwrap().iter() {
let module = binding.module().unwrap();
let mut ident = ident;
- if ident.ctxt.glob_adjust(module.expansion, binding.span.ctxt.modern()).is_none() {
+ if ident.ctxt.glob_adjust(module.expansion, binding.span.ctxt().modern()).is_none() {
continue
}
if self.resolve_ident_in_module_unadjusted(module, ident, ns, false, false, module.span)
new_binding: &NameBinding,
old_binding: &NameBinding) {
// Error on the second of two conflicting names
- if old_binding.span.lo > new_binding.span.lo {
+ if old_binding.span.lo() > new_binding.span.lo() {
return self.report_conflict(parent, ident, ns, old_binding, new_binding);
}