Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize by-value [T; N] iterator core::array::IntoIter #80470

Merged
merged 2 commits into from
Jan 31, 2021

Conversation

SimonSapin
Copy link
Contributor

Tracking issue: #65798

This is unblocked now that min_const_generics has been stabilized in #79135.

This PR does not include the corresponding IntoIterator impl, which is #65819. Instead, an iterator can be constructed through the new method.

new would become unnecessary when IntoIterator is implemented and might be deprecated then, although it will stay stable.

Tracking issue: rust-lang#65798

This is unblocked now that `min_const_generics` has been stabilized
in rust-lang#79135.

This PR does *not* include the corresponding `IntoIterator` impl,
which is rust-lang#65819.
Instead, an iterator can be constructed through the `new` method.

`new` would become unnecessary when `IntoIterator` is implemented
and might be deprecated then, although it will stay stable.
@SimonSapin SimonSapin added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. A-iterators Area: Iterators labels Dec 29, 2020
@rust-highfive
Copy link
Collaborator

r? @cramertj

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 29, 2020
@SimonSapin
Copy link
Contributor Author

Stabilizing this iterator type with a new constructor that might be deprecated when IntoIterator is implemented later.

@rfcbot fcp merge

@jonas-schievink jonas-schievink added the relnotes Marks issues that should be documented in the release notes of the next release. label Dec 29, 2020
@SimonSapin
Copy link
Contributor Author

Ah I forgot I need to be in the checkboxy list to propose FCP. @rust-lang/libs please start the process for:

Stabilizing this iterator type with a new constructor that might be deprecated when IntoIterator is implemented later.

@m-ou-se
Copy link
Member

m-ou-se commented Dec 30, 2020

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Dec 30, 2020

Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Dec 30, 2020
@m-ou-se m-ou-se assigned m-ou-se and unassigned cramertj Dec 30, 2020
@m-ou-se m-ou-se added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2020
@usbalbin usbalbin mentioned this pull request Jan 2, 2021
2 tasks
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Jan 20, 2021
@rfcbot
Copy link

rfcbot commented Jan 20, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jan 20, 2021
@SoniEx2
Copy link
Contributor

SoniEx2 commented Jan 21, 2021

Instead of having ::new, why not propose From for all stdlib iterators?

Co-authored-by: Ashley Mannix <kodraus@hey.com>
@SimonSapin
Copy link
Contributor Author

@SoniEx2 I’m not sure what impls you have in mind, could you spell them out?

@SoniEx2
Copy link
Contributor

SoniEx2 commented Jan 21, 2021

Instead of having an IntoIter::new(...), have an IntoIter::from(...) powered by trait From.

This would be undeprecatable but it feels less silly and could be extended to the other iterators. Then you'd just use .into() and impl Iterator<Item=...>.

// example usage
BTreeMap::<&'static str, &'static str>::from_iter([("a", "b")].into())

@SimonSapin
Copy link
Contributor Author

There’s no need to find another general pattern to turn collections into iterators, that’s the IntoIterator trait

@SoniEx2
Copy link
Contributor

SoniEx2 commented Jan 21, 2021

alternatively: [("a", "b")].into(): impl Iterator<Item=(&'static str, &'static str)>.collect::<BTreeMap<_, _>>()

the point is you'd use IntoIter::from() / [T; N].into() instead of [T; N].into_iter().

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Successfully built ef9d50b97d38
Successfully tagged rust-ci:latest
Built container sha256:ef9d50b97d388e6ba90f8388b0997d746b3b0aae438d65cbb1bfb909e713d215
Uploading finished image to https://ci-caches.rust-lang.org/docker/1d8776fc6611839c0fe1104032e04cb412cf84a696fcac0418b82e4341b3688a883196f99e2f55a0df0b3c67d154c62dd0c4630956d70292523c69687b63cce6
upload failed: - to s3://rust-lang-ci-sccache2/docker/1d8776fc6611839c0fe1104032e04cb412cf84a696fcac0418b82e4341b3688a883196f99e2f55a0df0b3c67d154c62dd0c4630956d70292523c69687b63cce6 Unable to locate credentials
[CI_JOB_NAME=x86_64-gnu-llvm-9]
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 29 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiii

 finished in 0.064 seconds
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i...i.ii....i.i....ii..........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 2.01s

 finished in 2.085 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
Suite("src/test/run-make") not skipped for "bootstrap::test::RunMake" -- not in ["src/tools/tidy"]
Check compiletest suite=run-make mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 20 tests
iiiiiiiiiiii........

 finished in 0.517 seconds
Build completed successfully in 0:29:22
+ python2.7 ../x.py --stage 2 test src/test/mir-opt --host= --target=i686-unknown-linux-gnu
---
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> i686-unknown-linux-gnu)

running 11271 tests
.....................i.............................................................................. 100/11271
.................................iiiiiiii.iiiiiiiii................................................. 200/11271
.................................................................................................... 400/11271
.................................................................................................... 500/11271
.................................................................................................... 600/11271
....................................................i............................................... 700/11271

@m-ou-se

This comment has been minimized.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 21, 2021
@m-ou-se m-ou-se removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 21, 2021
@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Jan 30, 2021
@rfcbot
Copy link

rfcbot commented Jan 30, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jan 30, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Jan 30, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 30, 2021

📌 Commit 83d32b0 has been approved by m-ou-se

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 30, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2021
…as-schievink

Rollup of 18 pull requests

Successful merges:

 - rust-lang#78044 (Implement io::Seek for io::Empty)
 - rust-lang#79285 (Stabilize Arc::{increment,decrement}_strong_count)
 - rust-lang#80053 (stabilise `cargo test -- --include-ignored`)
 - rust-lang#80279 (Implement missing `AsMut<str>` for `str`)
 - rust-lang#80470 (Stabilize by-value `[T; N]` iterator `core::array::IntoIter`)
 - rust-lang#80945 (Add Box::downcast() for dyn Any + Send + Sync)
 - rust-lang#81048 (Stabilize `core::slice::fill_with`)
 - rust-lang#81198 (Remove requirement that forces symmetric and transitive PartialEq impls to exist)
 - rust-lang#81422 (Account for existing `_` field pattern when suggesting `..`)
 - rust-lang#81472 (Clone entire `TokenCursor` when collecting tokens)
 - rust-lang#81484 (Optimize decimal formatting of 128-bit integers)
 - rust-lang#81491 (Balance sidebar `Deref` cycle check with main content)
 - rust-lang#81509 (Add a regression test for ICE of bad_placeholder_type)
 - rust-lang#81547 (Edit rustc_typeck top-level docs)
 - rust-lang#81550 (Replace predecessor with range in collections documentation)
 - rust-lang#81558 (Fix ascii art text wrapping in mobile)
 - rust-lang#81562 (Clarify that InPlaceIterable guarantees extend to all advancing iterator methods.)
 - rust-lang#81563 (Improve docblock readability on small screen)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1e99f26 into rust-lang:master Jan 31, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 31, 2021
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 11, 2021
sylvestre added a commit to sylvestre/coreutils that referenced this pull request Jul 30, 2021
sylvestre added a commit to sylvestre/coreutils that referenced this pull request Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-iterators Area: Iterators disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.