Skip to content

Commit a015eb1

Browse files
committed
Revert const hack and use const closure
1 parent 664177f commit a015eb1

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

compiler/rustc_passes/src/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn inherit_const_stability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
5454
match def_kind {
5555
DefKind::AssocFn | DefKind::AssocTy | DefKind::AssocConst { .. } => {
5656
match tcx.def_kind(tcx.local_parent(def_id)) {
57-
DefKind::Impl { .. } => true,
57+
DefKind::Trait | DefKind::Impl { .. } => true,
5858
_ => false,
5959
}
6060
}

library/core/src/iter/traits/iterator.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,11 @@ pub const trait Iterator {
226226
Self: Sized + [const] Destruct,
227227
Self::Item: [const] Destruct,
228228
{
229-
// FIXME(const-hack): revert this to a const closure
230-
#[rustc_const_unstable(feature = "const_iter", issue = "92476")]
231-
#[rustc_inherit_overflow_checks]
232-
const fn plus_one<T: [const] Destruct>(accum: usize, _elem: T) -> usize {
233-
accum + 1
234-
}
235-
self.fold(0, plus_one)
229+
self.fold(
230+
0,
231+
#[rustc_inherit_overflow_checks]
232+
const |accum, _elem| accum + 1,
233+
)
236234
}
237235

238236
/// Consumes the iterator, returning the last element.

0 commit comments

Comments
 (0)