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

alloc: implement FromIterator for Box<str> #99969

Merged
merged 1 commit into from
May 19, 2024

Conversation

calebsander
Copy link
Contributor

@calebsander calebsander commented Jul 30, 2022

Box<[T]> implements FromIterator<T> using Vec<T> + into_boxed_slice().
Add analogous FromIterator implementations for Box<str>
matching the current implementations for String.
Remove the Global allocator requirement for FromIterator<Box<str>> too.

ACP: rust-lang/libs-team#196

@rust-highfive
Copy link
Collaborator

r? @kennytm

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

@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jul 30, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2022
@calebsander
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 30, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 8, 2022
@pitaj
Copy link
Contributor

pitaj commented Jan 29, 2023

I believe this does require an ACP (insta-stable new implementation of stable trait on stable type). Please create one if you haven't already. Link it here and then label this PR as S-waiting-on-ACP.

@rustbot label -S-waiting-on-review +S-waiting-on-author

@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 Jan 29, 2023
@calebsander
Copy link
Contributor Author

ACP: rust-lang/libs-team#196

@calebsander
Copy link
Contributor Author

@rustbot label +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 25, 2023
@Dylan-DPC Dylan-DPC added S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 14, 2023
@dtolnay dtolnay assigned dtolnay and unassigned kennytm Jan 26, 2024
@dtolnay
Copy link
Member

dtolnay commented Jan 26, 2024

@rust-lang/libs-api:
@rfcbot fcp merge

+ impl FromIterator<char> for Box<str>
+ impl FromIterator<&char> for Box<str>
+ impl FromIterator<&str> for Box<str>
+ impl FromIterator<String> for Box<str>
+ impl<A: Allocator> FromIterator<Box<str, A>> for Box<str>
+ impl FromIterator<Cow<'_, str>> for Box<str>

- impl FromIterator<Box<str>> for String
+ impl<A: Allocator> FromIterator<Box<str, A>> for String

- impl Extend<Box<str>> for String
+ impl<A: Allocator> Extend<Box<str, A>> for String

@rfcbot
Copy link

rfcbot commented Jan 26, 2024

Team member @dtolnay 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 Jan 26, 2024
@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Mar 5, 2024
@rfcbot
Copy link

rfcbot commented Mar 5, 2024

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

stevenengler added a commit to shadow/shadow that referenced this pull request May 24, 2024
Previously shadow wouldn't compile on nightly due to a rust compiler
type inference change that breaks existing rust code, and they intend to
stabilize this change in a couple of months. For us that breakage occurs
in the time crate, so this PR upgrades all dependencies (including the
time library) to fix the build error.

rust-lang/rust#99969 (comment)

rust-lang/rust#125319
@apiraino
Copy link
Contributor

apiraino commented Jun 19, 2024

Adding relnotes label because someone reported this in #126685 (up to t-release to decide)

@rustbot label +relnotes

@rustbot rustbot added the relnotes Marks issues that should be documented in the release notes of the next release. label Jun 19, 2024
a-kenji added a commit to friedow/centerpiece that referenced this pull request Aug 10, 2024
`rustc --version`: `v1.80.0` has a type inference regression.
This causes compilation of `centerpiece` to fail, because we use an
affected version of the `time` crate.

This updates the time crate to a released version with a fix.

Reference:
- NixOS/nixpkgs#332957
- rust-lang/rust#125319
- rust-lang/rust#99969
a-kenji added a commit to friedow/centerpiece that referenced this pull request Aug 11, 2024
`rustc --version`: `v1.80.0` has a type inference regression. This
causes compilation of `centerpiece` to fail, because we use an affected
version of the `time` crate.

This updates the time crate to a released version with a fix.

Reference:
- NixOS/nixpkgs#332957
- rust-lang/rust#125319
- rust-lang/rust#99969
@tgross35
Copy link
Contributor

It seems this did not make it into the "Compatibility Notes" for https://doc.rust-lang.org/nightly/releases.html#version-1800-2024-07-25. @apiraino could it be retroactively added?

(coming here from the IRLO discussion https://internals.rust-lang.org/t/type-inference-breakage-in-1-80-has-not-been-handled-well)

@apiraino
Copy link
Contributor

Thanks Trevor for the ping. Relayed to T-release on Zulip.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 22, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? `@rust-lang/release`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 22, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ``@rust-lang/release``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 22, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ```@rust-lang/release```
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 23, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ````@rust-lang/release````
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 23, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? `````@rust-lang/release`````
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 23, 2024
…r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ``````@rust-lang/release``````
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 23, 2024
Rollup merge of rust-lang#129263 - apiraino:add-missing-compat-note, r=cuviper

Add a missing compatibility note in the 1.80.0 release notes

rust-lang#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ``````@rust-lang/release``````
eopb added a commit to eopb/cargo-clone that referenced this pull request Aug 24, 2024
Rust `1.80.0` introduced a [new trait implementation](rust-lang/rust#99969) which caused builds of [old versions of the `time` crate to fail](rust-lang/rust#127343).

Since `cargo clone` depends on one of these old `time` versions, build with rust `1.80.0` or later fail:

```
error[E0282]: type annotations needed for `Box<_>`
  --> /home/ethan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.30/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
```

Updating to a version of time with this regression fixed, with `cargo update -p time`, fixes the build of `cargo clone`.

It would also be helpful to get a new release of `cargo clone` after this is merged, since this is also causing the `cargo clone` package to [fail on NixOS](NixOS/nixpkgs#332957 (comment)).
eopb added a commit to eopb/cargo-clone that referenced this pull request Aug 24, 2024
Rust `1.80.0` introduced a [new trait implementation](rust-lang/rust#99969) which caused builds of [old versions of the `time` crate to fail](rust-lang/rust#127343).

Since `cargo clone` depends on one of these old `time` versions, builds with rust `1.80.0` or later fail:

```
error[E0282]: type annotations needed for `Box<_>`
  --> /home/ethan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.30/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
```

Updating to a version of time with this regression fixed, with `cargo update -p time`, fixes the build of `cargo clone`.

It would also be helpful to get a new release of `cargo clone` after this is merged, since this is also causing the `cargo clone` package to [fail on NixOS](NixOS/nixpkgs#332957 (comment)).
JanLikar pushed a commit to JanLikar/cargo-clone that referenced this pull request Aug 24, 2024
Rust `1.80.0` introduced a [new trait implementation](rust-lang/rust#99969) which caused builds of [old versions of the `time` crate to fail](rust-lang/rust#127343).

Since `cargo clone` depends on one of these old `time` versions, builds with rust `1.80.0` or later fail:

```
error[E0282]: type annotations needed for `Box<_>`
  --> /home/ethan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.30/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
```

Updating to a version of time with this regression fixed, with `cargo update -p time`, fixes the build of `cargo clone`.

It would also be helpful to get a new release of `cargo clone` after this is merged, since this is also causing the `cargo clone` package to [fail on NixOS](NixOS/nixpkgs#332957 (comment)).
Garmelon added a commit to Garmelon/latexfogel that referenced this pull request Oct 31, 2024
This updates the time crate to a version >= 0.3.35, which will compile
again on rustc >= 1.80.0.

See also:
rust-lang/rust#99969
rust-lang/rust#127343
time-rs/time#693
Garmelon added a commit to Garmelon/latexfogel that referenced this pull request Oct 31, 2024
By running `cargo update time`, this PR updates the time crate to a
version >= 0.3.35, meaning it will compile again on rustc >= 1.80.0.

See also:
rust-lang/rust#99969
rust-lang/rust#127343
time-rs/time#693
Garmelon added a commit to Garmelon/latexfogel that referenced this pull request Oct 31, 2024
By running `cargo update time`, this PR updates the time crate to a
version >= 0.3.35, meaning it will compile again on rustc >= 1.80.0.

See also:
rust-lang/rust#99969
rust-lang/rust#127343
time-rs/time#693
I-Al-Istannen pushed a commit to kitmatheinfo/latexfogel that referenced this pull request Oct 31, 2024
By running `cargo update time`, this PR updates the time crate to a
version >= 0.3.35, meaning it will compile again on rustc >= 1.80.0.

See also:
rust-lang/rust#99969
rust-lang/rust#127343
time-rs/time#693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. merged-by-bors This PR was explicitly merged by bors. 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. 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.