Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

‎compiler/rustc_middle/src/ty/sty.rs‎

Lines changed: 7 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /