File tree 1 file changed +14
-4
lines changed
compiler/rustc_middle/src/ty
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> {
1884
1884
}
1885
1885
1886
1886
#[ 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) )
1889
1894
}
1890
1895
1891
1896
#[ inline]
1892
1897
pub fn mk_generator (
1893
1898
self ,
1894
- id : DefId ,
1899
+ def_id : DefId ,
1895
1900
generator_substs : SubstsRef < ' tcx > ,
1896
1901
movability : hir:: Movability ,
1897
1902
) -> 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) )
1899
1909
}
1900
1910
1901
1911
#[ inline]
You can’t perform that action at this time.
0 commit comments