Skip to content

Commit 3c0c5b4

Browse files
authored
Rollup merge of #124380 - lcnr:std-unnecessary-params, r=Nilstrieb
`Range` iteration specialization: remove trivial bounds These bounds on impl items are trivially true and never checked by a caller. They end up shadowing the actual impls, currently preventing normalization in the new solver. While we may have to fix the underlying issue in the new solver at some point, for now this is an easy way to get us closer to compiling core with `-Znext-solver`. r? `@Nilstrieb`
2 parents 6c21abf + ce70584 commit 3c0c5b4

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

library/core/src/iter/adapters/step_by.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,7 @@ macro_rules! spec_int_ranges_r {
515515
unsafe impl StepByBackImpl<Range<$t>> for StepBy<Range<$t>> {
516516

517517
#[inline]
518-
fn spec_next_back(&mut self) -> Option<Self::Item>
519-
where Range<$t>: DoubleEndedIterator + ExactSizeIterator,
520-
{
518+
fn spec_next_back(&mut self) -> Option<Self::Item> {
521519
let step = self.original_step().get() as $t;
522520
let remaining = self.iter.end;
523521
if remaining > 0 {
@@ -533,9 +531,7 @@ macro_rules! spec_int_ranges_r {
533531
// We have to repeat them here so that the specialization overrides the StepByImplBack defaults
534532

535533
#[inline]
536-
fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item>
537-
where Self: DoubleEndedIterator,
538-
{
534+
fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
539535
if self.advance_back_by(n).is_err() {
540536
return None;
541537
}
@@ -544,10 +540,9 @@ macro_rules! spec_int_ranges_r {
544540

545541
#[inline]
546542
fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
547-
where
548-
Self: DoubleEndedIterator,
549-
F: FnMut(Acc, Self::Item) -> R,
550-
R: Try<Output = Acc>
543+
where
544+
F: FnMut(Acc, Self::Item) -> R,
545+
R: Try<Output = Acc>
551546
{
552547
let mut accum = init;
553548
while let Some(x) = self.next_back() {
@@ -558,9 +553,8 @@ macro_rules! spec_int_ranges_r {
558553

559554
#[inline]
560555
fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
561-
where
562-
Self: DoubleEndedIterator,
563-
F: FnMut(Acc, Self::Item) -> Acc
556+
where
557+
F: FnMut(Acc, Self::Item) -> Acc
564558
{
565559
let mut accum = init;
566560
while let Some(x) = self.next_back() {

0 commit comments

Comments
 (0)