diff --git a/crates/flux-fhir-analysis/src/conv/mod.rs b/crates/flux-fhir-analysis/src/conv/mod.rs index a0fa4c9ab2..e9b1516c74 100644 --- a/crates/flux-fhir-analysis/src/conv/mod.rs +++ b/crates/flux-fhir-analysis/src/conv/mod.rs @@ -20,7 +20,7 @@ use flux_middle::{ rty::{ self, fold::TypeFoldable, - refining::{self, Refiner}, + refining::{self, Refine, Refiner}, ESpan, List, RefineArgsExt, WfckResults, INNERMOST, }, MaybeExternId, @@ -1347,12 +1347,10 @@ impl<'genv, 'tcx: 'genv, P: ConvPhase<'genv, 'tcx>> ConvCtxt

{ ))? }; - let trait_ref = { - let trait_ref = trait_ref - .lower(tcx) - .map_err(|err| QueryErr::unsupported(trait_ref.def_id, err.into_err()))?; - self.refiner()?.refine_trait_ref(&trait_ref)? - }; + let trait_ref = trait_ref + .lower(tcx) + .map_err(|err| QueryErr::unsupported(trait_ref.def_id, err.into_err()))? + .refine(&self.refiner()?)?; let assoc_item = self .trait_defines_associated_item_named(trait_ref.def_id, AssocKind::Type, assoc_ident) diff --git a/crates/flux-fhir-analysis/src/conv/struct_compat.rs b/crates/flux-fhir-analysis/src/conv/struct_compat.rs index 809c5b09df..ac2fc9b38e 100644 --- a/crates/flux-fhir-analysis/src/conv/struct_compat.rs +++ b/crates/flux-fhir-analysis/src/conv/struct_compat.rs @@ -14,7 +14,7 @@ use flux_middle::{ rty::{ self, fold::{TypeFoldable, TypeFolder, TypeSuperFoldable}, - refining::Refiner, + refining::{Refine as _, Refiner}, }, MaybeExternId, }; @@ -30,7 +30,7 @@ pub(crate) fn type_alias( def_id: MaybeExternId, ) -> QueryResult { let rust_ty = genv.lower_type_of(def_id.resolved_id())?.skip_binder(); - let expected = Refiner::default_for_item(genv, def_id.resolved_id())?.refine_ty(&rust_ty)?; + let expected = rust_ty.refine(&Refiner::default_for_item(genv, def_id.resolved_id())?)?; let mut zipper = Zipper::new(genv, def_id); if zipper @@ -54,8 +54,8 @@ pub(crate) fn fn_sig( def_id: MaybeExternId, ) -> QueryResult { let rust_fn_sig = genv.lower_fn_sig(def_id.resolved_id())?.skip_binder(); - let expected = - Refiner::default_for_item(genv, def_id.resolved_id())?.refine_poly_fn_sig(&rust_fn_sig)?; + + let expected = Refiner::default_for_item(genv, def_id.resolved_id())?.refine(&rust_fn_sig)?; let mut zipper = Zipper::new(genv, def_id); if let Err(err) = zipper.zip_poly_fn_sig(fn_sig, &expected) { diff --git a/crates/flux-middle/src/global_env.rs b/crates/flux-middle/src/global_env.rs index 32e9ee66ae..fe25c326cb 100644 --- a/crates/flux-middle/src/global_env.rs +++ b/crates/flux-middle/src/global_env.rs @@ -20,7 +20,11 @@ use crate::{ cstore::CrateStoreDyn, fhir::{self, VariantIdx}, queries::{Providers, Queries, QueryErr, QueryResult}, - rty::{self, normalize::SpecFuncDefns, refining::Refiner}, + rty::{ + self, + normalize::SpecFuncDefns, + refining::{Refine as _, Refiner}, + }, MaybeExternId, ResolvedDefId, }; @@ -232,8 +236,8 @@ impl<'genv, 'tcx> GlobalEnv<'genv, 'tcx> { let trait_ref = trait_ref.skip_binder(); let trait_ref = trait_ref .lower(self.tcx()) - .map_err(|err| QueryErr::unsupported(trait_ref.def_id, err.into_err()))?; - let trait_ref = Refiner::default_for_item(self, impl_id)?.refine_trait_ref(&trait_ref)?; + .map_err(|err| QueryErr::unsupported(trait_ref.def_id, err.into_err()))? + .refine(&Refiner::default_for_item(self, impl_id)?)?; Ok(Some(rty::EarlyBinder(trait_ref))) } diff --git a/crates/flux-middle/src/queries.rs b/crates/flux-middle/src/queries.rs index 27d9587407..bbe2593fc8 100644 --- a/crates/flux-middle/src/queries.rs +++ b/crates/flux-middle/src/queries.rs @@ -25,7 +25,7 @@ use crate::{ global_env::GlobalEnv, rty::{ self, - refining::{self, Refiner}, + refining::{self, Refine, Refiner}, }, MaybeExternId, ResolvedDefId, }; @@ -526,10 +526,8 @@ impl<'genv, 'tcx> Queries<'genv, 'tcx> { .item_bounds(def_id) .skip_binder() .lower(genv.tcx()) - .map_err(|err| QueryErr::unsupported(def_id, err))?; - - let clauses = - Refiner::default_for_item(genv, def_id)?.refine_clauses(&clauses)?; + .map_err(|err| QueryErr::unsupported(def_id, err))? + .refine(&Refiner::default_for_item(genv, def_id)?)?; Ok(rty::EarlyBinder(clauses)) }, @@ -549,9 +547,9 @@ impl<'genv, 'tcx> Queries<'genv, 'tcx> { |def_id| (self.providers.predicates_of)(genv, def_id.local_id()), |def_id| genv.cstore().predicates_of(def_id), |def_id| { - let predicates = genv.lower_predicates_of(def_id)?; - let predicates = Refiner::default_for_item(genv, def_id)? - .refine_generic_predicates(&predicates)?; + let predicates = genv + .lower_predicates_of(def_id)? + .refine(&Refiner::default_for_item(genv, def_id)?)?; Ok(rty::EarlyBinder(predicates)) }, ) @@ -713,9 +711,10 @@ impl<'genv, 'tcx> Queries<'genv, 'tcx> { |def_id| (self.providers.fn_sig)(genv, def_id.local_id()), |def_id| genv.cstore().fn_sig(def_id), |def_id| { - let fn_sig = genv.lower_fn_sig(def_id)?.skip_binder(); - let fn_sig = - Refiner::default_for_item(genv, def_id)?.refine_poly_fn_sig(&fn_sig)?; + let fn_sig = genv + .lower_fn_sig(def_id)? + .skip_binder() + .refine(&Refiner::default_for_item(genv, def_id)?)?; Ok(rty::EarlyBinder(fn_sig)) }, ) diff --git a/crates/flux-middle/src/rty/mod.rs b/crates/flux-middle/src/rty/mod.rs index 4754f7b1f0..7e8f142377 100644 --- a/crates/flux-middle/src/rty/mod.rs +++ b/crates/flux-middle/src/rty/mod.rs @@ -41,7 +41,7 @@ use flux_rustc_bridge::{ }; use itertools::Itertools; pub use normalize::SpecFuncDefns; -use refining::Refiner; +use refining::{Refine as _, Refiner}; use rustc_data_structures::{fx::FxIndexMap, unord::UnordMap}; use rustc_hir::{def_id::DefId, LangItem, Safety}; use rustc_index::{newtype_index, IndexSlice}; @@ -1223,11 +1223,10 @@ impl Ty { let def_id = genv.tcx().require_lang_item(LangItem::OwnedBox, None); let generics = genv.generics_of(def_id)?; - let alloc_ty = Refiner::default_for_item(genv, def_id)?.refine_ty( - &genv - .lower_type_of(generics.own_params[1].def_id)? - .skip_binder(), - )?; + let alloc_ty = genv + .lower_type_of(generics.own_params[1].def_id)? + .skip_binder() + .refine(&Refiner::default_for_item(genv, def_id)?)?; Ty::mk_box(genv, deref_ty, alloc_ty) } diff --git a/crates/flux-middle/src/rty/refining.rs b/crates/flux-middle/src/rty/refining.rs index 9504169665..ca9fb2a152 100644 --- a/crates/flux-middle/src/rty/refining.rs +++ b/crates/flux-middle/src/rty/refining.rs @@ -3,7 +3,7 @@ //! Concretely, this module provides functions to go from types in [`flux_rustc_bridge::ty`] to //! types in [`rty`]. -use flux_arc_interner::List; +use flux_arc_interner::{List, SliceInternable}; use flux_common::bug; use flux_rustc_bridge::{ty, ty::GenericArgsExt as _}; use itertools::Itertools; @@ -101,100 +101,11 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { }) } - pub(crate) fn refine_generic_predicates( - &self, - generics: &ty::GenericPredicates, - ) -> QueryResult { - Ok(rty::GenericPredicates { - parent: generics.parent, - predicates: self.refine_clauses(&generics.predicates)?, - }) + pub fn refine(&self, t: &T) -> QueryResult { + t.refine(self) } - pub(crate) fn refine_clauses(&self, clauses: &[ty::Clause]) -> QueryResult> { - let clauses = clauses - .iter() - .flat_map(|clause| self.refine_clause(clause).transpose()) - .try_collect()?; - - Ok(clauses) - } - - fn refine_clause(&self, clause: &ty::Clause) -> QueryResult> { - let kind = match &clause.kind.as_ref().skip_binder() { - ty::ClauseKind::Trait(trait_pred) => { - let pred = rty::TraitPredicate { - trait_ref: self.refine_trait_ref(&trait_pred.trait_ref)?, - }; - rty::ClauseKind::Trait(pred) - } - ty::ClauseKind::Projection(proj_pred) => { - let rty::TyOrBase::Base(term) = self.refine_ty_or_base(&proj_pred.term)? else { - return Err(query_bug!( - self.def_id, - "sorry, we can't handle non-base associated types" - )); - }; - let pred = rty::ProjectionPredicate { - projection_ty: self - .refine_alias_ty(ty::AliasKind::Projection, &proj_pred.projection_ty)?, - term, - }; - rty::ClauseKind::Projection(pred) - } - ty::ClauseKind::TypeOutlives(pred) => { - let pred = rty::OutlivesPredicate(self.refine_ty(&pred.0)?, pred.1); - rty::ClauseKind::TypeOutlives(pred) - } - ty::ClauseKind::ConstArgHasType(const_, ty) => { - rty::ClauseKind::ConstArgHasType(const_.clone(), self.as_default().refine_ty(ty)?) - } - }; - let kind = rty::Binder::bind_with_vars(kind, List::empty()); - Ok(Some(rty::Clause { kind })) - } - - pub fn refine_existential_predicate( - &self, - poly_pred: &ty::PolyExistentialPredicate, - ) -> QueryResult { - self.refine_binders(poly_pred, |pred| { - let pred = match pred { - ty::ExistentialPredicate::Trait(trait_ref) => { - rty::ExistentialPredicate::Trait(rty::ExistentialTraitRef { - def_id: trait_ref.def_id, - args: self.refine_existential_predicate_generic_args( - trait_ref.def_id, - &trait_ref.args, - )?, - }) - } - ty::ExistentialPredicate::Projection(projection) => { - let rty::TyOrBase::Base(term) = self.refine_ty_or_base(&projection.term)? - else { - return Err(query_bug!( - self.def_id, - "sorry, we can't handle non-base associated types" - )); - }; - rty::ExistentialPredicate::Projection(rty::ExistentialProjection { - def_id: projection.def_id, - args: self.refine_existential_predicate_generic_args( - projection.def_id, - &projection.args, - )?, - term, - }) - } - ty::ExistentialPredicate::AutoTrait(def_id) => { - rty::ExistentialPredicate::AutoTrait(*def_id) - } - }; - Ok(pred) - }) - } - - pub fn refine_existential_predicate_generic_args( + fn refine_existential_predicate_generic_args( &self, def_id: DefId, args: &ty::GenericArgs, @@ -210,14 +121,6 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { .try_collect() } - pub fn refine_trait_ref(&self, trait_ref: &ty::TraitRef) -> QueryResult { - let trait_ref = rty::TraitRef { - def_id: trait_ref.def_id, - args: self.refine_generic_args(trait_ref.def_id, &trait_ref.args)?, - }; - Ok(trait_ref) - } - pub fn refine_variant_def( &self, adt_def_id: DefId, @@ -230,7 +133,7 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { .iter() .map(|fld| { let ty = self.genv.lower_type_of(fld.did)?.instantiate_identity(); - self.refine_ty(&ty) + ty.refine(self) }) .try_collect()?; let value = rty::VariantSig::new( @@ -242,34 +145,6 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { Ok(rty::Binder::bind_with_vars(value, List::empty())) } - pub fn refine_binders( - &self, - t: &ty::Binder, - mut f: F, - ) -> QueryResult> - where - F: FnMut(&S) -> QueryResult, - { - let vars = refine_bound_variables(t.vars()); - let inner = t.as_ref().skip_binder(); - let inner = f(inner)?; - Ok(rty::Binder::bind_with_vars(inner, vars)) - } - - pub fn refine_poly_fn_sig(&self, fn_sig: &ty::PolyFnSig) -> QueryResult { - self.refine_binders(fn_sig, |fn_sig| { - let inputs = fn_sig - .inputs() - .iter() - .map(|ty| self.refine_ty(ty)) - .try_collect()?; - let ret = self.refine_ty(fn_sig.output())?.shift_in_escaping(1); - let output = - rty::Binder::bind_with_vars(rty::FnOutput::new(ret, vec![]), List::empty()); - Ok(rty::FnSig::new(fn_sig.safety, fn_sig.abi, List::empty(), inputs, output)) - }) - } - fn refine_generic_args( &self, def_id: DefId, @@ -292,7 +167,7 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { ) -> QueryResult { match (¶m.kind, arg) { (rty::GenericParamDefKind::Type { .. }, ty::GenericArg::Ty(ty)) => { - Ok(rty::GenericArg::Ty(self.refine_ty(ty)?)) + Ok(rty::GenericArg::Ty(ty.refine(self)?)) } (rty::GenericParamDefKind::Base { .. }, ty::GenericArg::Ty(ty)) => { let rty::TyOrBase::Base(contr) = self.refine_ty_or_base(ty)? else { @@ -330,10 +205,6 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { Ok(rty::AliasTy::new(def_id, args, refine_args)) } - pub fn refine_ty(&self, ty: &ty::Ty) -> QueryResult { - Ok(self.refine_ty_or_base(ty)?.into_ty()) - } - pub fn refine_ty_or_base(&self, ty: &ty::Ty) -> QueryResult { let bty = match ty.kind() { ty::TyKind::Closure(did, args) => { @@ -341,30 +212,27 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { let upvar_tys = closure_args .upvar_tys() .iter() - .map(|ty| self.refine_ty(ty)) + .map(|ty| ty.refine(self)) .try_collect()?; rty::BaseTy::Closure(*did, upvar_tys, args.clone()) } ty::TyKind::Coroutine(did, args) => { let args = args.as_coroutine(); - let resume_ty = self.refine_ty(args.resume_ty())?; - let upvar_tys = args - .upvar_tys() - .map(|ty| self.refine_ty(ty)) - .try_collect()?; + let resume_ty = args.resume_ty().refine(self)?; + let upvar_tys = args.upvar_tys().map(|ty| ty.refine(self)).try_collect()?; rty::BaseTy::Coroutine(*did, resume_ty, upvar_tys) } ty::TyKind::CoroutineWitness(..) => { bug!("implement when we know what this is"); } ty::TyKind::Never => rty::BaseTy::Never, - ty::TyKind::Ref(r, ty, mutbl) => rty::BaseTy::Ref(*r, self.refine_ty(ty)?, *mutbl), + ty::TyKind::Ref(r, ty, mutbl) => rty::BaseTy::Ref(*r, ty.refine(self)?, *mutbl), ty::TyKind::Float(float_ty) => rty::BaseTy::Float(*float_ty), ty::TyKind::Tuple(tys) => { - let tys = tys.iter().map(|ty| self.refine_ty(ty)).try_collect()?; + let tys = tys.iter().map(|ty| ty.refine(self)).try_collect()?; rty::BaseTy::Tuple(tys) } - ty::TyKind::Array(ty, len) => rty::BaseTy::Array(self.refine_ty(ty)?, len.clone()), + ty::TyKind::Array(ty, len) => rty::BaseTy::Array(ty.refine(self)?, len.clone()), ty::TyKind::Param(param_ty) => { match self.param(*param_ty)?.kind { rty::GenericParamDefKind::Type { .. } => { @@ -393,18 +261,16 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { ty::TyKind::Int(int_ty) => rty::BaseTy::Int(*int_ty), ty::TyKind::Uint(uint_ty) => rty::BaseTy::Uint(*uint_ty), ty::TyKind::Str => rty::BaseTy::Str, - ty::TyKind::Slice(ty) => rty::BaseTy::Slice(self.refine_ty(ty)?), + ty::TyKind::Slice(ty) => rty::BaseTy::Slice(ty.refine(self)?), ty::TyKind::Char => rty::BaseTy::Char, ty::TyKind::FnPtr(poly_fn_sig) => { - rty::BaseTy::FnPtr(self.as_default().refine_poly_fn_sig(poly_fn_sig)?) - } - ty::TyKind::RawPtr(ty, mu) => { - rty::BaseTy::RawPtr(self.as_default().refine_ty(ty)?, *mu) + rty::BaseTy::FnPtr(poly_fn_sig.refine(&self.as_default())?) } + ty::TyKind::RawPtr(ty, mu) => rty::BaseTy::RawPtr(ty.refine(&self.as_default())?, *mu), ty::TyKind::Dynamic(exi_preds, r) => { let exi_preds = exi_preds .iter() - .map(|ty| self.refine_existential_predicate(ty)) + .map(|pred| pred.refine(self)) .try_collect()?; rty::BaseTy::Dynamic(exi_preds, *r) } @@ -429,6 +295,171 @@ impl<'genv, 'tcx> Refiner<'genv, 'tcx> { } } +pub trait Refine { + type Output; + + fn refine(&self, refiner: &Refiner) -> QueryResult; +} + +impl Refine for ty::Ty { + type Output = rty::Ty; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + Ok(refiner.refine_ty_or_base(self)?.into_ty()) + } +} + +impl Refine for ty::Binder { + type Output = rty::Binder; + + fn refine(&self, refiner: &Refiner) -> QueryResult> { + let vars = refine_bound_variables(self.vars()); + let inner = self.skip_binder_ref().refine(refiner)?; + Ok(rty::Binder::bind_with_vars(inner, vars)) + } +} + +impl Refine for ty::FnSig { + type Output = rty::FnSig; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + let inputs = self + .inputs() + .iter() + .map(|ty| ty.refine(refiner)) + .try_collect()?; + let ret = self.output().refine(refiner)?.shift_in_escaping(1); + let output = rty::Binder::bind_with_vars(rty::FnOutput::new(ret, vec![]), List::empty()); + Ok(rty::FnSig::new(self.safety, self.abi, List::empty(), inputs, output)) + } +} + +impl Refine for ty::Clause { + type Output = rty::Clause; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + Ok(rty::Clause { kind: self.kind.refine(refiner)? }) + } +} + +impl Refine for ty::TraitRef { + type Output = rty::TraitRef; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + Ok(rty::TraitRef { + def_id: self.def_id, + args: refiner.refine_generic_args(self.def_id, &self.args)?, + }) + } +} + +impl Refine for ty::ClauseKind { + type Output = rty::ClauseKind; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + let kind = match self { + ty::ClauseKind::Trait(trait_pred) => { + let pred = rty::TraitPredicate { trait_ref: trait_pred.trait_ref.refine(refiner)? }; + rty::ClauseKind::Trait(pred) + } + ty::ClauseKind::Projection(proj_pred) => { + let rty::TyOrBase::Base(term) = refiner.refine_ty_or_base(&proj_pred.term)? else { + return Err(query_bug!( + refiner.def_id, + "sorry, we can't handle non-base associated types" + )); + }; + let pred = rty::ProjectionPredicate { + projection_ty: refiner + .refine_alias_ty(ty::AliasKind::Projection, &proj_pred.projection_ty)?, + term, + }; + rty::ClauseKind::Projection(pred) + } + ty::ClauseKind::TypeOutlives(pred) => { + let pred = rty::OutlivesPredicate(pred.0.refine(refiner)?, pred.1); + rty::ClauseKind::TypeOutlives(pred) + } + ty::ClauseKind::ConstArgHasType(const_, ty) => { + rty::ClauseKind::ConstArgHasType(const_.clone(), ty.refine(&refiner.as_default())?) + } + }; + Ok(kind) + } +} + +impl Refine for ty::ExistentialPredicate { + type Output = rty::ExistentialPredicate; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + let pred = match self { + ty::ExistentialPredicate::Trait(trait_ref) => { + rty::ExistentialPredicate::Trait(rty::ExistentialTraitRef { + def_id: trait_ref.def_id, + args: refiner.refine_existential_predicate_generic_args( + trait_ref.def_id, + &trait_ref.args, + )?, + }) + } + ty::ExistentialPredicate::Projection(projection) => { + let rty::TyOrBase::Base(term) = refiner.refine_ty_or_base(&projection.term)? else { + return Err(query_bug!( + refiner.def_id, + "sorry, we can't handle non-base associated types" + )); + }; + rty::ExistentialPredicate::Projection(rty::ExistentialProjection { + def_id: projection.def_id, + args: refiner.refine_existential_predicate_generic_args( + projection.def_id, + &projection.args, + )?, + term, + }) + } + ty::ExistentialPredicate::AutoTrait(def_id) => { + rty::ExistentialPredicate::AutoTrait(*def_id) + } + }; + Ok(pred) + } +} + +impl Refine for ty::GenericPredicates { + type Output = rty::GenericPredicates; + + fn refine(&self, refiner: &Refiner) -> QueryResult { + Ok(rty::GenericPredicates { + parent: self.parent, + predicates: refiner.refine(&self.predicates)?, + }) + } +} + +impl Refine for List +where + T: SliceInternable, + T: Refine, +{ + type Output = rty::List; + + fn refine(&self, refiner: &Refiner) -> QueryResult> { + refiner.refine(&self[..]) + } +} + +impl Refine for [T] +where + T: Refine, +{ + type Output = rty::List; + + fn refine(&self, refiner: &Refiner) -> QueryResult> { + self.iter().map(|t| refiner.refine(t)).try_collect() + } +} + fn refine_default(bty: rty::BaseTy) -> rty::SubsetTyCtor { let sort = bty.sort(); let constr = rty::SubsetTy::trivial(bty.shift_in_escaping(1), rty::Expr::nu()); diff --git a/crates/flux-refineck/src/checker.rs b/crates/flux-refineck/src/checker.rs index 5d1e71cfa4..f432e5b598 100644 --- a/crates/flux-refineck/src/checker.rs +++ b/crates/flux-refineck/src/checker.rs @@ -15,7 +15,7 @@ use flux_middle::{ rty::{ self, fold::{TypeFoldable, TypeFolder, TypeSuperFoldable}, - refining::Refiner, + refining::{Refine, Refiner}, AdtDef, BaseTy, Binder, Bool, Clause, CoroutineObligPredicate, EarlyBinder, Expr, FnOutput, FnTraitPredicate, GenericArg, GenericArgs, GenericArgsExt as _, Int, IntTy, Mutability, Path, PolyFnSig, PtrKind, Ref, RefineArgs, RefineArgsExt, @@ -1565,11 +1565,11 @@ impl<'ck, 'genv, 'tcx, M: Mode> Checker<'ck, 'genv, 'tcx, M> { } fn refine_default(&self, ty: &ty::Ty) -> QueryResult { - self.default_refiner.refine_ty(ty) + ty.refine(&self.default_refiner) } fn refine_with_holes(&self, ty: &ty::Ty) -> QueryResult { - Refiner::with_holes(self.genv, self.def_id.to_def_id())?.refine_ty(ty) + ty.refine(&Refiner::with_holes(self.genv, self.def_id.to_def_id())?) } }