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

Add TryFrom<&[T]> for [T; $N] where T: Copy #56216

Merged
merged 1 commit into from
Nov 30, 2018

Conversation

SimonSapin
Copy link
Contributor

TryFrom<&[T]> for &[T; $N] (note reference to an array) already exists, but not needing to dereference makes type inference easier for example when using u32::from_be_bytes.

Also add doc examples doing just that.

@SimonSapin SimonSapin added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 25, 2018
@rust-highfive
Copy link
Collaborator

r? @aidanhs

(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 Nov 25, 2018
@SimonSapin
Copy link
Contributor Author

This will conflict with #56207, I’ll rebase when that lands.

@withoutboats
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 25, 2018

📌 Commit 8281de4888cfbfa22bb5ab915891ae298e097e9c has been approved by withoutboats

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 25, 2018
`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists,
but not needing to dereference makes type inference easier
for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
@SimonSapin
Copy link
Contributor Author

Removed #![feature] in doc tests for feature stabilized in #56207.

@bors r=withoutboats

@bors
Copy link
Contributor

bors commented Nov 25, 2018

📌 Commit 057e6d3 has been approved by withoutboats

kennytm added a commit to kennytm/rust that referenced this pull request Nov 27, 2018
…ithoutboats

Add TryFrom<&[T]> for [T; $N] where T: Copy

`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 28, 2018
…ithoutboats

Add TryFrom<&[T]> for [T; $N] where T: Copy

`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 29, 2018
…ithoutboats

Add TryFrom<&[T]> for [T; $N] where T: Copy

`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
kennytm added a commit to kennytm/rust that referenced this pull request Nov 30, 2018
…ithoutboats

Add TryFrom<&[T]> for [T; $N] where T: Copy

`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
kennytm added a commit to kennytm/rust that referenced this pull request Nov 30, 2018
…ithoutboats

Add TryFrom<&[T]> for [T; $N] where T: Copy

`TryFrom<&[T]> for &[T; $N]` (note *reference* to an array) already exists, but not needing to dereference makes type inference easier for example when using `u32::from_be_bytes`.

Also add doc examples doing just that.
bors added a commit that referenced this pull request Nov 30, 2018
Rollup of 19 pull requests

Successful merges:

 - #55011 (Add libstd Cargo feature "panic_immediate_abort")
 - #55821 (Use sort_by_cached_key when the key function is not trivial/free)
 - #56014 (add test for issue #21335)
 - #56131 (Assorted tweaks)
 - #56214 (Implement chalk unification routines)
 - #56216 (Add TryFrom<&[T]> for [T; $N] where T: Copy)
 - #56268 (Reuse the `P` in `InvocationCollector::fold_{,opt_}expr`.)
 - #56324 (Use raw_entry for more efficient interning)
 - #56336 (Clean up and streamline the pretty-printer)
 - #56337 (Fix const_fn ICE with non-const function pointer)
 - #56339 (Remove not used option)
 - #56341 (Rename conversion util; remove duplicate util in librustc_codegen_llvm.)
 - #56349 (rustc 1.30.0's linker flavor inference is a non-backwards compat change to -Clinker)
 - #56355 (Add inline attributes and add unit to CommonTypes)
 - #56360 (Optimize local linkchecker program)
 - #56364 (Fix panic with outlives in existential type)
 - #56365 (Stabilize self_struct_ctor feature.)
 - #56367 (Moved some feature gate tests to correct location)
 - #56373 (Update books)
@bors bors merged commit 057e6d3 into rust-lang:master Nov 30, 2018
@SimonSapin SimonSapin deleted the array-tryfrom-slice branch January 4, 2019 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants