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 @@ -1872,18 +1872,28 @@ impl<'tcx> TyCtxt<'tcx> {
1872
1872
}
1873
1873
1874
1874
#[ inline]
1875
- pub fn mk_closure ( self , closure_id : DefId , closure_substs : SubstsRef < ' tcx > ) -> Ty < ' tcx > {
1876
- self . mk_ty_from_kind ( Closure ( closure_id, closure_substs) )
1875
+ pub fn mk_closure ( self , def_id : DefId , closure_substs : SubstsRef < ' tcx > ) -> Ty < ' tcx > {
1876
+ debug_assert_eq ! (
1877
+ closure_substs. len( ) ,
1878
+ self . generics_of( self . typeck_root_def_id( def_id) ) . count( ) + 3 ,
1879
+ "closure constructed with incorrect substitutions"
1880
+ ) ;
1881
+ self . mk_ty_from_kind ( Closure ( def_id, closure_substs) )
1877
1882
}
1878
1883
1879
1884
#[ inline]
1880
1885
pub fn mk_generator (
1881
1886
self ,
1882
- id : DefId ,
1887
+ def_id : DefId ,
1883
1888
generator_substs : SubstsRef < ' tcx > ,
1884
1889
movability : hir:: Movability ,
1885
1890
) -> Ty < ' tcx > {
1886
- self . mk_ty_from_kind ( Generator ( id, generator_substs, movability) )
1891
+ debug_assert_eq ! (
1892
+ generator_substs. len( ) ,
1893
+ self . generics_of( self . typeck_root_def_id( def_id) ) . count( ) + 5 ,
1894
+ "generator constructed with incorrect number of substitutions"
1895
+ ) ;
1896
+ self . mk_ty_from_kind ( Generator ( def_id, generator_substs, movability) )
1887
1897
}
1888
1898
1889
1899
#[ inline]
You can’t perform that action at this time.
0 commit comments