From 031243898eaa138056ea7248fb37324ffaa561e1 Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 19 Jul 2021 13:03:29 +0200 Subject: [PATCH] check for cycles in `default_anon_const_substs` --- compiler/rustc_typeck/src/collect/type_of.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 9b10874b8bcf..2f0a5eb79bc1 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -275,6 +275,11 @@ fn get_path_containing_arg_in_pat<'hir>( } pub(super) fn default_anon_const_substs(tcx: TyCtxt<'_>, def_id: DefId) -> SubstsRef<'_> { + let generics = tcx.generics_of(def_id); + if let Some(parent) = generics.parent { + let _cycle_check = tcx.predicates_of(parent); + } + let substs = InternalSubsts::identity_for_item(tcx, def_id); // We only expect substs with the following type flags as default substs. //