Skip to content

Commit ce3b6f5

Browse files
Expose iter::ByRefSized as unstable feature and use it
1 parent bc3fae4 commit ce3b6f5

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

library/alloc/src/collections/vec_deque/spec_extend.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::alloc::Allocator;
22
use crate::vec;
3-
use core::iter::TrustedLen;
3+
use core::iter::{ByRefSized, TrustedLen};
44
use core::slice;
55

66
use super::VecDeque;

library/alloc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
#![feature(unchecked_math)]
144144
#![feature(unicode_internals)]
145145
#![feature(unsize)]
146+
#![feature(std_internals)]
146147
//
147148
// Language features:
148149
#![feature(allocator_internals)]

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ use crate::ops::Try;
44
///
55
/// Ideally this will no longer be required, eventually, but as can be seen in
66
/// the benchmarks (as of Feb 2022 at least) `by_ref` can have performance cost.
7-
pub(crate) struct ByRefSized<'a, I>(pub &'a mut I);
7+
#[unstable(feature = "std_internals", issue = "none")]
8+
#[derive(Debug)]
9+
pub struct ByRefSized<'a, I>(pub &'a mut I);
810

11+
#[unstable(feature = "std_internals", issue = "none")]
912
impl<I: Iterator> Iterator for ByRefSized<'_, I> {
1013
type Item = I::Item;
1114

@@ -47,6 +50,7 @@ impl<I: Iterator> Iterator for ByRefSized<'_, I> {
4750
}
4851
}
4952

53+
#[unstable(feature = "std_internals", issue = "none")]
5054
impl<I: DoubleEndedIterator> DoubleEndedIterator for ByRefSized<'_, I> {
5155
#[inline]
5256
fn next_back(&mut self) -> Option<Self::Item> {

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ pub use self::{
3232
scan::Scan, skip::Skip, skip_while::SkipWhile, take::Take, take_while::TakeWhile, zip::Zip,
3333
};
3434

35-
pub(crate) use self::by_ref_sized::ByRefSized;
35+
#[unstable(feature = "std_internals", issue = "none")]
36+
pub use self::by_ref_sized::ByRefSized;
3637

3738
#[stable(feature = "iter_cloned", since = "1.1.0")]
3839
pub use self::cloned::Cloned;

library/core/src/iter/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ pub use self::traits::{
398398

399399
#[stable(feature = "iter_zip", since = "1.59.0")]
400400
pub use self::adapters::zip;
401+
#[unstable(feature = "std_internals", issue = "none")]
402+
pub use self::adapters::ByRefSized;
401403
#[stable(feature = "iter_cloned", since = "1.1.0")]
402404
pub use self::adapters::Cloned;
403405
#[stable(feature = "iter_copied", since = "1.36.0")]
@@ -422,7 +424,7 @@ pub use self::adapters::{
422424
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
423425
pub use self::adapters::{Intersperse, IntersperseWith};
424426

425-
pub(crate) use self::adapters::{try_process, ByRefSized};
427+
pub(crate) use self::adapters::try_process;
426428

427429
mod adapters;
428430
mod range;

0 commit comments

Comments
 (0)