diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-29 20:40:45 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-03-29 20:40:47 -0400 |
| commit | 5e2c54977202a0a245dca4bfd5171ced47bed487 (patch) | |
| tree | 1b3064eb2ad89e15144ee02d0e902a6ccc59c11e | |
| parent | faae5f1ffe7b7b97e91eee6184807ac7307aafaa (diff) | |
| download | rust-5e2c54977202a0a245dca4bfd5171ced47bed487.tar.gz rust-5e2c54977202a0a245dca4bfd5171ced47bed487.zip | |
Assert that ADTs have the right number of substs
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 57a675e4453..b5e619f1e2a 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1624,6 +1624,13 @@ impl<'tcx> Ty<'tcx> { #[inline] pub fn new_adt(tcx: TyCtxt<'tcx>, def: AdtDef<'tcx>, args: GenericArgsRef<'tcx>) -> Ty<'tcx> { + debug_assert_eq!( + tcx.generics_of(def.did()).count(), + args.len(), + "wrong number of args for ADT: {:#?} vs {:#?}", + tcx.generics_of(def.did()).params, + args + ); Ty::new(tcx, Adt(def, args)) } |
