Use Span instead of SyntaxContext in Ident
This commit is contained in:
parent
48fa6f9631
commit
baae274fb7
23 changed files with 146 additions and 93 deletions
|
|
@ -909,7 +909,7 @@ impl<'a> LoweringContext<'a> {
|
|||
|
||||
fn lower_ident(&mut self, ident: Ident) -> Name {
|
||||
let ident = ident.modern();
|
||||
if ident.ctxt == SyntaxContext::empty() {
|
||||
if ident.span.ctxt() == SyntaxContext::empty() {
|
||||
return ident.name;
|
||||
}
|
||||
*self.name_map
|
||||
|
|
@ -2089,10 +2089,7 @@ impl<'a> LoweringContext<'a> {
|
|||
name: self.lower_ident(match f.ident {
|
||||
Some(ident) => ident,
|
||||
// FIXME(jseyfried) positional field hygiene
|
||||
None => Ident {
|
||||
name: Symbol::intern(&index.to_string()),
|
||||
ctxt: f.span.ctxt(),
|
||||
},
|
||||
None => Ident::new(Symbol::intern(&index.to_string()), f.span),
|
||||
}),
|
||||
vis: self.lower_visibility(&f.vis, None),
|
||||
ty: self.lower_ty(&f.ty, ImplTraitContext::Disallowed),
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Ident {
|
|||
hasher: &mut StableHasher<W>) {
|
||||
let ast::Ident {
|
||||
ref name,
|
||||
ctxt: _ // Ignore this
|
||||
span: _ // Ignore this
|
||||
} = *self;
|
||||
|
||||
name.hash_stable(hcx, hasher);
|
||||
|
|
|
|||
|
|
@ -2088,8 +2088,8 @@ impl<'a, 'gcx, 'tcx> VariantDef {
|
|||
return Some(index);
|
||||
}
|
||||
let mut ident = name.to_ident();
|
||||
while ident.ctxt != SyntaxContext::empty() {
|
||||
ident.ctxt.remove_mark();
|
||||
while ident.span.ctxt() != SyntaxContext::empty() {
|
||||
ident.span.remove_mark();
|
||||
if let Some(field) = self.fields.iter().position(|f| f.name.to_ident() == ident) {
|
||||
return Some(field);
|
||||
}
|
||||
|
|
@ -2558,7 +2558,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
LOCAL_CRATE => self.hir.definitions().expansion(scope.index),
|
||||
_ => Mark::root(),
|
||||
};
|
||||
let scope = match ident.ctxt.adjust(expansion) {
|
||||
let scope = match ident.span.adjust(expansion) {
|
||||
Some(macro_def) => self.hir.definitions().macro_def_scope(macro_def),
|
||||
None if block == DUMMY_NODE_ID => DefId::local(CRATE_DEF_INDEX), // Dummy DefId
|
||||
None => self.hir.get_module_parent(block),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue