{to,from}_{ne,le,be}_bytes for unsigned integer types#53358
Merged
bors merged 2 commits intorust-lang:masterfrom Aug 17, 2018
Merged
{to,from}_{ne,le,be}_bytes for unsigned integer types#53358bors merged 2 commits intorust-lang:masterfrom
{to,from}_{ne,le,be}_bytes for unsigned integer types#53358bors merged 2 commits intorust-lang:masterfrom
Conversation
Same as rust-lang#51919 did for signed integers. Tracking issue: rust-lang#52963
Contributor
|
r? @shepmaster (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
|
Sorry, don't know how I missed that. |
shepmaster
reviewed
Aug 16, 2018
src/libcore/num/mod.rs
Outdated
| /// ``` | ||
| /// #![feature(int_to_from_bytes)] | ||
| /// | ||
| /// let bytes = 0x12345678i32.to_be_bytes(); |
Member
There was a problem hiding this comment.
I like the example in the other code that gratuitously uses underscores to make this easy to follow:
let bytes = 0x12_34_56_78_i32.to_be_bytes();
assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
shepmaster
reviewed
Aug 16, 2018
| /// #![feature(int_to_from_bytes)] | ||
| /// | ||
| /// let bytes = i32::min_value().to_be().to_ne_bytes(); | ||
| /// assert_eq!(bytes, [0x80, 0, 0, 0]); |
Member
There was a problem hiding this comment.
Will this pass on all of the testbed machines?
Contributor
There was a problem hiding this comment.
Yes, due to the to_be() in there.
Member
|
Seems fine to me and it's all unstable anyway. r=me after adjusting the tests to split up the long literals (or you can ignore that and r=me anyway, if you disagree) |
Contributor
Author
|
@bors r=shepmaster |
Collaborator
|
📌 Commit f5556a6 has been approved by |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
Aug 17, 2018
`{to,from}_{ne,le,be}_bytes` for unsigned integer types
Same as rust-lang#51919 did for signed integers.
Tracking issue: rust-lang#52963
bors
added a commit
that referenced
this pull request
Aug 17, 2018
Rollup of 11 pull requests Successful merges: - #52858 (Implement Iterator::size_hint for Elaborator.) - #53321 (Fix usage of `wasm_target_feature`) - #53326 ([nll] add regression test for issue #27868) - #53347 (rustc_resolve: don't allow paths starting with `::crate`.) - #53349 ([nll] add tests for #48697 and #30104) - #53357 (Pretty print btreemap for GDB) - #53358 (`{to,from}_{ne,le,be}_bytes` for unsigned integer types) - #53406 (Do not suggest conversion method that is already there) - #53407 (make more ported compile fail tests more robust w.r.t. NLL) - #53413 (Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018.) - #53434 (wasm: Remove --strip-debug argument to LLD) Failed merges: r? @ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same as #51919 did for signed integers.
Tracking issue: #52963