Skip to content

Commit 93a39ee

Browse files
committed
wip on fixing more ICEs (this might make it worse)
1 parent 4122d4a commit 93a39ee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter, RegionInferReason};
2323
/// inferred constraints concerning which regions outlive other regions.
2424
#[instrument(level = "debug", skip(tcx))]
2525
pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
26+
// Anon const as RHS of const item is the body, so should have the same predicates.
27+
// FIXME(mgca): probably should have only the predicates of params that are explicitly referenced,
28+
// as should generics_of (maybe only under mgca?)
29+
if matches!(tcx.def_kind(def_id), DefKind::AnonConst)
30+
&& let parent = tcx.parent(def_id)
31+
&& matches!(tcx.def_kind(parent), DefKind::Const | DefKind::AssocConst)
32+
{
33+
return tcx.predicates_of(parent);
34+
}
35+
2636
let mut result = tcx.explicit_predicates_of(def_id);
2737
debug!("predicates_of: explicit_predicates_of({:?}) = {:?}", def_id, result);
2838

0 commit comments

Comments
 (0)