Skip to content

Commit 0312438

Browse files
committed
check for cycles in default_anon_const_substs
1 parent 2140016 commit 0312438

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_typeck/src/collect/type_of.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ fn get_path_containing_arg_in_pat<'hir>(
275275
}
276276

277277
pub(super) fn default_anon_const_substs(tcx: TyCtxt<'_>, def_id: DefId) -> SubstsRef<'_> {
278+
let generics = tcx.generics_of(def_id);
279+
if let Some(parent) = generics.parent {
280+
let _cycle_check = tcx.predicates_of(parent);
281+
}
282+
278283
let substs = InternalSubsts::identity_for_item(tcx, def_id);
279284
// We only expect substs with the following type flags as default substs.
280285
//

0 commit comments

Comments
 (0)