Skip to content

Conversation

@Folyd
Copy link
Contributor

@Folyd Folyd commented Dec 1, 2024

Currently, we have no way to get back to origin Iterator after call peekable(),
this PR impl From<Peekable<I>> trait for Iterator.

@rustbot
Copy link
Collaborator

rustbot commented Dec 1, 2024

r? @cuviper

rustbot has assigned @cuviper.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 1, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling compiler_builtins v0.1.138
error: implementation has missing stability attribute
  --> library/core/src/iter/adapters/peekable.rs:52:1
   |
52 | / impl<I: Iterator> From<Peekable<I>> for I {
53 | |     fn from(p: Peekable<I>) -> Self {
54 | |         p.iter
56 | | }
   | |_^

error: could not compile `core` (lib) due to 1 previous error

@Noratrieb
Copy link
Member

Thank you for the PR! This PR contains a public library API change, which should follow the proper process of creating an ACP first: https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html
Use @rustbot ready when your ACP has been accepeted.
@rustbot author

Personally, I think having an inherent into_inner method would make more sense.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2024
@cuviper
Copy link
Member

cuviper commented Dec 1, 2024

There have been previous rejected ACPs for this:

@Folyd
Copy link
Contributor Author

Folyd commented Dec 2, 2024

Thanks for let me know the ACP. Is reasonable to only add From trait impl instead adding inner()/into_inner()?

@oli-obk
Copy link
Contributor

oli-obk commented Dec 2, 2024

I don't see this PR being accepted in its current state or with modifications. The rationale from the previous attempts still apply, so I'm closing it.

The T-libs result was to write your own iterators or to use by_ref to preserve the original iterator

@oli-obk oli-obk closed this Dec 2, 2024
@Folyd Folyd deleted the from-peekable branch December 2, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants