Change:
b: Ty<'tcx>, ckind: CItemKind, ) -> bool { <del> debug!("structurally_same_type(cx, a = {:?}, b = {:?})", a, b); let tcx = cx.tcx; if a == b || rustc_middle::ty::TyS::same_type(a, b) { // All nominally-same types are structurally same, too. true } else { // Do a full, depth-first comparison between the two. use rustc_middle::ty::TyKind::*; let a_kind = &a.kind; let b_kind = &b.kind; let compare_layouts = |a, b| -> bool { let a_layout = &cx.layout_of(a).unwrap().layout.abi; let b_layout = &cx.layout_of(b).unwrap().layout.abi; debug!("{:?} == {:?} = {}", a_layout, b_layout, a_layout == b_layout); a_layout == b_layout }; </del> <ins> fn structurally_same_type_impl<'tcx>( seen_types: &mut FxHashSet<(Ty<'tcx>, Ty<'tcx>)>, cx: &LateContext<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>, ckind: CItemKind, ) -> bool { debug!("structurally_same_type_impl(cx, a = {:?}, b = {:?})", a, b); if !seen_types.insert((a, b)) { // We've encountered a cycle. There's no point going any further -- the types are // structurally the same. return true; } let tcx = cx.tcx; if a == b || rustc_middle::ty::TyS::same_type(a, b) { // All nominally-same types are structurally same, too. true } else { // Do a full, depth-first comparison between the two. use rustc_middle::ty::TyKind::*; let a_kind = &a.kind; let b_kind = &b.kind; let compare_layouts = |a, b| -> bool { let a_layout = &cx.layout_of(a).unwrap().layout.abi; let b_layout = &cx.layout_of(b).unwrap().layout.abi; debug!("{:?} == {:?} = {}", a_layout, b_layout, a_layout == b_layout); a_layout == b_layout }; #[allow(rustc::usage_of_ty_tykind)] let is_primitive_or_pointer = |kind: &ty::TyKind<'_>| { kind.is_primitive() || matches!(kind, RawPtr(..) | Ref(..)) }; </ins> <del> #[allow(rustc::usage_of_ty_tykind)] let is_primitive_or_pointer = |kind: &ty::TyKind<'_>| kind.is_primitive() || matches!(kind, RawPtr(..)); match (a_kind, b_kind) { (Adt(_, a_substs), Adt(_, b_substs)) => { let a = a.subst(cx.tcx, a_substs); let b = b.subst(cx.tcx, b_substs); debug!("Comparing {:?} and {:?}", a, b); if let (Adt(a_def, ..), Adt(b_def, ..)) = (&a.kind, &b.kind) { // Grab a flattened representation of all fields. let a_fields = a_def.variants.iter().flat_map(|v| v.fields.iter()); let b_fields = b_def.variants.iter().flat_map(|v| v.fields.iter()); compare_layouts(a, b) </del> <ins> ensure_sufficient_stack(|| { match (a_kind, b_kind) { (Adt(a_def, a_substs), Adt(b_def, b_substs)) => { let a = a.subst(cx.tcx, a_substs); let b = b.subst(cx.tcx, b_substs); debug!("Comparing {:?} and {:?}", a, b); // Grab a flattened representation of all fields. let a_fields = a_def.variants.iter().flat_map(|v| v.fields.iter()); let b_fields = b_def.variants.iter().flat_map(|v| v.fields.iter()); compare_layouts(a, b) </ins> && a_fields.eq_by( b_fields, |&ty::FieldDef { did: a_did, .. }, &ty::FieldDef { did: b_did, .. }| { <del> Self::structurally_same_type( </del> <ins> structurally_same_type_impl( seen_types, </ins> cx, tcx.type_of(a_did), tcx.type_of(b_did),

Discussion:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --It seems rustc can no longer handle how much is defined in these two binding files. If I comment out either module, it will successfully build. It was previously building on . Building this project on Windows: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
This is the stack overflow. Some recursive call in ClashingExternDeclaration checking. I think this is . I tried to set across the files to see if it might help, but I am not sure if that is exposed. I didn't dig into too much, but it still seems to trigger. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --I am not sure why I don't see the commit hash in the build. First time building the compiler. : <details<summary<strongWindbg stacktrace</strong</summary</details
Pinging for clashingexterndeclarations in the meantime.
Uh oh, that's not good. Thanks for reporting! I'll get on this now. claim