Skip to content

Commit f117f4c

Browse files
committed
fix compiler
1 parent 1824371 commit f117f4c

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

compiler/rustc_borrowck/src/borrow_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'tcx> BorrowSet<'tcx> {
161161
}
162162

163163
pub(crate) fn indices(&self) -> impl Iterator<Item = BorrowIndex> {
164-
BorrowIndex::from_usize(0)..BorrowIndex::from_usize(self.len())
164+
(BorrowIndex::from_usize(0)..BorrowIndex::from_usize(self.len())).into_iter()
165165
}
166166

167167
pub(crate) fn iter_enumerated(&self) -> impl Iterator<Item = (BorrowIndex, &BorrowData<'tcx>)> {

compiler/rustc_borrowck/src/region_infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
21402140
// we still want to screen for an "interesting" point to
21412141
// highlight (e.g., a call site or something).
21422142
let target_scc = self.constraint_sccs.scc(target_region);
2143-
let mut range = 0..path.len();
2143+
let mut range = (0..path.len()).into_iter();
21442144

21452145
// As noted above, when reporting an error, there is typically a chain of constraints
21462146
// leading from some "source" region which must outlive some "target" region.

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn expand_deriving_partial_ord(
2828
// No data, placing the tag check first makes codegen simpler
2929
0 => true,
3030
1..=2 => false,
31-
_ => (0..dataful.len() - 1).any(|i| {
31+
_ => (0..dataful.len() - 1).into_iter().any(|i| {
3232
if dataful[i]
3333
&& let Some(idx) = dataful[i + 1..].iter().position(|v| *v)
3434
{

compiler/rustc_const_eval/src/interpret/projection.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub trait Projectable<'tcx, Prov: Provenance>: Sized + std::fmt::Debug {
9999
/// A type representing iteration over the elements of an array.
100100
pub struct ArrayIterator<'tcx, 'a, Prov: Provenance, P: Projectable<'tcx, Prov>> {
101101
base: &'a P,
102-
range: Range<u64>,
102+
range: <Range<u64> as IntoIterator>::IntoIter,
103103
stride: Size,
104104
field_layout: TyAndLayout<'tcx>,
105105
_phantom: PhantomData<Prov>, // otherwise it says `Prov` is never used...
@@ -280,7 +280,13 @@ where
280280
debug!("project_array_fields: {base:?} {len}");
281281
base.offset(len * stride, self.layout_of(self.tcx.types.unit).unwrap(), self)?;
282282
// Create the iterator.
283-
Ok(ArrayIterator { base, range: 0..len, stride, field_layout, _phantom: PhantomData })
283+
Ok(ArrayIterator {
284+
base,
285+
range: (0..len).into_iter(),
286+
stride,
287+
field_layout,
288+
_phantom: PhantomData,
289+
})
284290
}
285291

286292
/// Subslicing

compiler/rustc_metadata/src/rmeta/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<T: ParameterizedOverTcx> LazyValue<T> {
261261
}
262262

263263
struct DecodeIterator<'a, 'tcx, T> {
264-
elem_counter: std::ops::Range<usize>,
264+
elem_counter: <std::ops::Range<usize> as IntoIterator>::IntoIter,
265265
dcx: DecodeContext<'a, 'tcx>,
266266
_phantom: PhantomData<fn() -> T>,
267267
}
@@ -304,7 +304,7 @@ impl<T: ParameterizedOverTcx> LazyArray<T> {
304304
{
305305
let mut dcx = metadata.decoder(self.position.get());
306306
dcx.lazy_state = LazyState::NodeStart(self.position);
307-
DecodeIterator { elem_counter: (0..self.num_elems), dcx, _phantom: PhantomData }
307+
DecodeIterator { elem_counter: (0..self.num_elems).into_iter(), dcx, _phantom: PhantomData }
308308
}
309309
}
310310

compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl InitMaskMaterialized {
534534
end: Size,
535535
is_init: bool,
536536
) -> Option<Size> {
537-
(start..end).find(|&i| init_mask.get(i) == is_init)
537+
(start..end).into_iter().find(|&i| init_mask.get(i) == is_init)
538538
}
539539

540540
let result = find_bit_fast(self, start, end, is_init);

compiler/rustc_parse/src/parser/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ impl<'a> Parser<'a> {
29102910
}
29112911

29122912
pub fn is_diff_marker(&mut self, long_kind: &TokenKind, short_kind: &TokenKind) -> bool {
2913-
(0..3).all(|i| self.look_ahead(i, |tok| tok == long_kind))
2913+
(0..3).into_iter().all(|i| self.look_ahead(i, |tok| tok == long_kind))
29142914
&& self.look_ahead(3, |tok| tok == short_kind)
29152915
}
29162916

compiler/rustc_parse/src/parser/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ impl<'a> Parser<'a> {
10751075
// we are in has non-skipped delimiters. Look for skipped
10761076
// delimiters in the lookahead range.
10771077
let tree_cursor = &self.token_cursor.tree_cursor;
1078-
let all_normal = (0..dist).all(|i| {
1078+
let all_normal = (0..dist).into_iter().all(|i| {
10791079
let token = tree_cursor.look_ahead(i);
10801080
!matches!(token, Some(TokenTree::Delimited(_, Delimiter::Invisible, _)))
10811081
});

0 commit comments

Comments
 (0)