Skip to content

Commit 5e2c549

Browse files
Assert that ADTs have the right number of substs
1 parent faae5f1 commit 5e2c549

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+7
-0
lines changed

Diff for: compiler/rustc_middle/src/ty/sty.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,13 @@ impl<'tcx> Ty<'tcx> {
16241624

16251625
#[inline]
16261626
pub fn new_adt(tcx: TyCtxt<'tcx>, def: AdtDef<'tcx>, args: GenericArgsRef<'tcx>) -> Ty<'tcx> {
1627+
debug_assert_eq!(
1628+
tcx.generics_of(def.did()).count(),
1629+
args.len(),
1630+
"wrong number of args for ADT: {:#?} vs {:#?}",
1631+
tcx.generics_of(def.did()).params,
1632+
args
1633+
);
16271634
Ty::new(tcx, Adt(def, args))
16281635
}
16291636

0 commit comments

Comments
 (0)