1
Fork 0

Effects cleanup

- removed extra bits from predicates queries that are no longer needed in the new system
- removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
This commit is contained in:
Deadbeef 2024-10-26 10:18:42 +08:00
parent c1db4dc242
commit f6fea83342
23 changed files with 40 additions and 97 deletions

View file

@ -86,11 +86,9 @@ impl<'tcx> MonoItem<'tcx> {
}
}
pub fn is_generic_fn(&self, tcx: TyCtxt<'tcx>) -> bool {
pub fn is_generic_fn(&self) -> bool {
match self {
MonoItem::Fn(instance) => {
instance.args.non_erasable_generics(tcx, instance.def_id()).next().is_some()
}
MonoItem::Fn(instance) => instance.args.non_erasable_generics().next().is_some(),
MonoItem::Static(..) | MonoItem::GlobalAsm(..) => false,
}
}

View file

@ -70,7 +70,7 @@ impl<'tcx> Ty<'tcx> {
/// ADTs with no type arguments.
pub fn is_simple_text(self, tcx: TyCtxt<'tcx>) -> bool {
match self.kind() {
Adt(def, args) => args.non_erasable_generics(tcx, def.did()).next().is_none(),
Adt(_, args) => args.non_erasable_generics().next().is_none(),
Ref(_, ty, _) => ty.is_simple_text(tcx),
_ => self.is_simple_ty(),
}

View file

@ -501,9 +501,6 @@ impl<'tcx> GenericArgs<'tcx> {
#[inline]
pub fn non_erasable_generics(
&'tcx self,
// FIXME(effects): Remove these
_tcx: TyCtxt<'tcx>,
_def_id: DefId,
) -> impl DoubleEndedIterator<Item = GenericArgKind<'tcx>> + 'tcx {
self.iter().filter_map(|k| match k.unpack() {
ty::GenericArgKind::Lifetime(_) => None,

View file

@ -360,7 +360,6 @@ impl<'tcx> Generics {
pub struct GenericPredicates<'tcx> {
pub parent: Option<DefId>,
pub predicates: &'tcx [(Clause<'tcx>, Span)],
pub effects_min_tys: &'tcx ty::List<Ty<'tcx>>,
}
impl<'tcx> GenericPredicates<'tcx> {

View file

@ -204,7 +204,7 @@ impl<'tcx> Instance<'tcx> {
}
// If this a non-generic instance, it cannot be a shared monomorphization.
self.args.non_erasable_generics(tcx, self.def_id()).next()?;
self.args.non_erasable_generics().next()?;
// compiler_builtins cannot use upstream monomorphizations.
if tcx.is_compiler_builtins(LOCAL_CRATE) {