1
Fork 0

Debug assertions hate this trick

This commit is contained in:
Oli Scherer 2022-12-14 15:37:47 +00:00
parent 49536667ff
commit 18373fae35

View file

@ -2577,17 +2577,17 @@ impl<'tcx> TyCtxt<'tcx> {
#[inline(always)] #[inline(always)]
fn check_substs( fn check_substs(
self, self,
def_id: DefId, _def_id: DefId,
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>, substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
) -> SubstsRef<'tcx> { ) -> SubstsRef<'tcx> {
let substs = substs.into_iter().map(Into::into); let substs = substs.into_iter().map(Into::into);
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {
let n = self.generics_of(def_id).count(); let n = self.generics_of(_def_id).count();
assert_eq!( assert_eq!(
(n, Some(n)), (n, Some(n)),
substs.size_hint(), substs.size_hint(),
"wrong number of generic parameters for {def_id:?}: {:?}", "wrong number of generic parameters for {_def_id:?}: {:?}",
substs.collect::<Vec<_>>(), substs.collect::<Vec<_>>(),
); );
} }