File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1884,18 +1884,28 @@ impl<'tcx> TyCtxt<'tcx> {
18841884 }
18851885
18861886 #[ inline]
1887- pub fn mk_closure ( self , closure_id : DefId , closure_substs : SubstsRef < ' tcx > ) -> Ty < ' tcx > {
1888- self . mk_ty_from_kind ( Closure ( closure_id, closure_substs) )
1887+ pub fn mk_closure ( self , def_id : DefId , closure_substs : SubstsRef < ' tcx > ) -> Ty < ' tcx > {
1888+ debug_assert_eq ! (
1889+ closure_substs. len( ) ,
1890+ self . generics_of( self . typeck_root_def_id( def_id) ) . count( ) + 3 ,
1891+ "closure constructed with incorrect substitutions"
1892+ ) ;
1893+ self . mk_ty_from_kind ( Closure ( def_id, closure_substs) )
18891894 }
18901895
18911896 #[ inline]
18921897 pub fn mk_generator (
18931898 self ,
1894- id : DefId ,
1899+ def_id : DefId ,
18951900 generator_substs : SubstsRef < ' tcx > ,
18961901 movability : hir:: Movability ,
18971902 ) -> Ty < ' tcx > {
1898- self . mk_ty_from_kind ( Generator ( id, generator_substs, movability) )
1903+ debug_assert_eq ! (
1904+ generator_substs. len( ) ,
1905+ self . generics_of( self . typeck_root_def_id( def_id) ) . count( ) + 5 ,
1906+ "generator constructed with incorrect number of substitutions"
1907+ ) ;
1908+ self . mk_ty_from_kind ( Generator ( def_id, generator_substs, movability) )
18991909 }
19001910
19011911 #[ inline]
You can’t perform that action at this time.
0 commit comments