Fix IndexVec::drain_enumerated
This commit is contained in:
parent
6ba6d22bdf
commit
280f69d858
@ -207,7 +207,12 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||||||
&'a mut self,
|
&'a mut self,
|
||||||
range: R,
|
range: R,
|
||||||
) -> impl Iterator<Item = (I, T)> + 'a {
|
) -> impl Iterator<Item = (I, T)> + 'a {
|
||||||
self.raw.drain(range).enumerate().map(|(n, t)| (I::new(n), t))
|
let begin = match range.start_bound() {
|
||||||
|
std::ops::Bound::Included(i) => *i,
|
||||||
|
std::ops::Bound::Excluded(i) => i.checked_add(1).unwrap(),
|
||||||
|
std::ops::Bound::Unbounded => 0,
|
||||||
|
};
|
||||||
|
self.raw.drain(range).enumerate().map(move |(n, t)| (I::new(begin + n), t))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -30,10 +30,7 @@ pub(super) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
|||||||
| ty::Foreign(..)
|
| ty::Foreign(..)
|
||||||
| ty::Alias(ty::Projection, ..)
|
| ty::Alias(ty::Projection, ..)
|
||||||
| ty::Bound(..)
|
| ty::Bound(..)
|
||||||
| ty::Infer(ty::TyVar(_)) => {
|
| ty::Infer(ty::TyVar(_)) => Err(NoSolution),
|
||||||
// FIXME: Do we need to mark anything as ambiguous here? Yeah?
|
|
||||||
Err(NoSolution)
|
|
||||||
}
|
|
||||||
|
|
||||||
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => bug!(),
|
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => bug!(),
|
||||||
|
|
||||||
@ -101,9 +98,8 @@ pub(super) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
|||||||
| ty::Dynamic(..)
|
| ty::Dynamic(..)
|
||||||
| ty::Foreign(..)
|
| ty::Foreign(..)
|
||||||
| ty::Alias(..)
|
| ty::Alias(..)
|
||||||
| ty::Param(_) => Err(NoSolution),
|
| ty::Param(_)
|
||||||
|
| ty::Infer(ty::TyVar(_)) => Err(NoSolution),
|
||||||
ty::Infer(ty::TyVar(_)) => bug!("FIXME: ambiguous"),
|
|
||||||
|
|
||||||
ty::Placeholder(..)
|
ty::Placeholder(..)
|
||||||
| ty::Bound(..)
|
| ty::Bound(..)
|
||||||
@ -151,9 +147,8 @@ pub(super) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
|||||||
| ty::Ref(_, _, Mutability::Mut)
|
| ty::Ref(_, _, Mutability::Mut)
|
||||||
| ty::Adt(_, _)
|
| ty::Adt(_, _)
|
||||||
| ty::Alias(_, _)
|
| ty::Alias(_, _)
|
||||||
| ty::Param(_) => Err(NoSolution),
|
| ty::Param(_)
|
||||||
|
| ty::Infer(ty::TyVar(_)) => Err(NoSolution),
|
||||||
ty::Infer(ty::TyVar(_)) => bug!("FIXME: ambiguous"),
|
|
||||||
|
|
||||||
ty::Placeholder(..)
|
ty::Placeholder(..)
|
||||||
| ty::Bound(..)
|
| ty::Bound(..)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user