Skip to content

Commit 3339fa5

Browse files
committed
check args in new_coroutine_witness
1 parent 1553adf commit 3339fa5

File tree

1 file changed

+5
-2
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+5
-2
lines changed

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,13 @@ impl<'tcx> Ty<'tcx> {
821821
#[inline]
822822
pub fn new_coroutine_witness(
823823
tcx: TyCtxt<'tcx>,
824-
id: DefId,
824+
def_id: DefId,
825825
args: GenericArgsRef<'tcx>,
826826
) -> Ty<'tcx> {
827-
Ty::new(tcx, CoroutineWitness(id, args))
827+
if cfg!(debug_assertions) {
828+
tcx.debug_assert_args_compatible(tcx.typeck_root_def_id(def_id), args);
829+
}
830+
Ty::new(tcx, CoroutineWitness(def_id, args))
828831
}
829832

830833
// misc

0 commit comments

Comments
 (0)