1
Fork 0

Separate the lifetime of the session and the arena in the resolver

This commit is contained in:
Oli Scherer 2022-12-08 12:59:02 +00:00
parent e9ab7872fd
commit 43a5cc383d
12 changed files with 79 additions and 70 deletions

View file

@ -65,7 +65,7 @@ impl<'a, Id: Into<DefId>> ToNameBinding<'a> for (Res, ty::Visibility<Id>, Span,
}
}
impl<'a> Resolver<'a> {
impl<'a, 'tcx> Resolver<'a, 'tcx> {
/// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
/// otherwise, reports an error.
pub(crate) fn define<T>(&mut self, parent: Module<'a>, ident: Ident, ns: Namespace, def: T)
@ -214,18 +214,18 @@ impl<'a> Resolver<'a> {
}
}
struct BuildReducedGraphVisitor<'a, 'b> {
r: &'b mut Resolver<'a>,
struct BuildReducedGraphVisitor<'a, 'b, 'tcx> {
r: &'b mut Resolver<'a, 'tcx>,
parent_scope: ParentScope<'a>,
}
impl<'a> AsMut<Resolver<'a>> for BuildReducedGraphVisitor<'a, '_> {
fn as_mut(&mut self) -> &mut Resolver<'a> {
impl<'a, 'tcx> AsMut<Resolver<'a, 'tcx>> for BuildReducedGraphVisitor<'a, '_, 'tcx> {
fn as_mut(&mut self) -> &mut Resolver<'a, 'tcx> {
self.r
}
}
impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
fn resolve_visibility(&mut self, vis: &ast::Visibility) -> ty::Visibility {
self.try_resolve_visibility(vis, true).unwrap_or_else(|err| {
self.r.report_vis_error(err);
@ -1315,7 +1315,7 @@ macro_rules! method {
};
}
impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
method!(visit_expr: ast::Expr, ast::ExprKind::MacCall, walk_expr);
method!(visit_pat: ast::Pat, ast::PatKind::MacCall, walk_pat);
method!(visit_ty: ast::Ty, ast::TyKind::MacCall, walk_ty);