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

to_xe_bytes for isize and usize returns an array of different size #59979

Merged
merged 1 commit into from
May 9, 2019

Conversation

stepancheg
Copy link
Contributor

... on different platforms.

Official rustdoc of
usize::to_le_bytes
displays signature

pub fn to_ne_bytes(self) -> [u8; 8]

which might be misleading: this function returns 4 bytes on 32-bit
systems.

With this commit applied rustdoc for isize and usize is this:
2019-04-15_0020

@rust-highfive
Copy link
Collaborator

r? @bluss

(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 Apr 14, 2019
src/libcore/num/mod.rs Outdated Show resolved Hide resolved
src/libcore/num/mod.rs Outdated Show resolved Hide resolved
@jonas-schievink jonas-schievink added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Apr 17, 2019
@bors
Copy link
Contributor

bors commented Apr 17, 2019

☔ The latest upstream changes (presumably #60013) made this pull request unmergeable. Please resolve the merge conflicts.

@stepancheg
Copy link
Contributor Author

Rebased and added the article. Looks like this now:

2019-04-24_0027

@Centril
Copy link
Contributor

Centril commented Apr 28, 2019

r? @ehuss

@rust-highfive rust-highfive assigned ehuss and unassigned bluss Apr 28, 2019
@Centril
Copy link
Contributor

Centril commented Apr 29, 2019

@bors delegate=ehuss

@bors
Copy link
Contributor

bors commented Apr 29, 2019

✌️ @ehuss can now approve this pull request

@ehuss
Copy link
Contributor

ehuss commented Apr 30, 2019

Can a similar treatment be done for from_*_bytes which I believe also take different sizes?

@stepancheg
Copy link
Contributor Author

Updated PR with from_*_bytes docs.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:04a3f5dc:start=1557088832296510136,finish=1557088833116044029,duration=819533893
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---

[00:04:32] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:32] tidy error: /checkout/src/libcore/num/mod.rs:240: line longer than 100 chars
[00:04:32] tidy error: /checkout/src/libcore/num/mod.rs:2294: line longer than 100 chars
[00:04:37] some tidy checks failed
[00:04:37] 
[00:04:37] 
[00:04:37] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:37] 
[00:04:37] 
[00:04:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:37] Build completed unsuccessfully in 0:01:06
[00:04:37] Build completed unsuccessfully in 0:01:06
[00:04:37] Makefile:67: recipe for target 'tidy' failed
[00:04:37] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00e626b8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun May  5 20:45:21 UTC 2019
---
travis_time:end:03f61b54:start=1557089122744413341,finish=1557089122749326561,duration=4913220
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0e305d00
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:11f5b3b4
travis_time:start:11f5b3b4
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:00814a69
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

... on different platforms.

Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature

```
pub fn to_ne_bytes(self) -> [u8; 8]
```

which might be misleading: this function returns 4 bytes on 32-bit
systems.
@ehuss
Copy link
Contributor

ehuss commented May 7, 2019

Thank you!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 7, 2019

📌 Commit 764e366 has been approved by ehuss

@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 May 7, 2019
@bors
Copy link
Contributor

bors commented May 8, 2019

⌛ Testing commit 764e366 with merge 3b68ed23f1364433b0d6a7f652ae73a42b38a10a...

@bors
Copy link
Contributor

bors commented May 8, 2019

💔 Test failed - checks-travis

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-aux of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[02:12:49] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/cargotest" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build/ct"
[02:12:49] expected success, got: exit code: 101
[02:12:49] 
[02:12:49] 
[02:12:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/test/run-pass/pretty src/test/run-fail/pretty src/test/run-pass-valgrind/pretty src/test/run-pass-fulldeps/pretty src/tools/cargo src/tools/cargotest
[02:12:49] Build completed unsuccessfully in 0:43:43
[02:12:49] make: *** [check-aux] Error 1
[02:12:49] Makefile:50: recipe for target 'check-aux' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:09d69d10
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed May  8 05:38:40 UTC 2019
---
travis_time:end:11fbc164:start=1557293924206558359,finish=1557293924214982811,duration=8424452
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:11a4d8e9
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:start:crashlog
obj/cores/core.5500.!checkout!obj!build!x86_64-unknown-linux-gnu!stage2!bin!rustc
[New LWP 5501]
[New LWP 5500]
warning: Could not load shared library symbols for 8 libraries, e.g. /lib/x86_64-linux-gnu/libc.so.6.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `rustc --crate-name foo src/lib.rs --color never --crate-type lib --emit=dep-inf'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f5daceca428 in ?? ()
[Current thread is 1 (LWP 5501)]
#0  0x00007f5daceca428 in ?? ()
#1  0x00007f5dacecc02a in ?? ()
#2  0x0000000000000020 in ?? ()
#3  0x0000000000000000 in ?? ()
travis_time:end:11a4d8e9:start=1557293924219875345,finish=1557293926215863072,duration=1995987727
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1eb0873f
travis_time:start:1eb0873f
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:32df34d5
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 8, 2019
@ehuss
Copy link
Contributor

ehuss commented May 8, 2019

Network error: [02:12:48] warning: spurious network error (2 tries remaining): failed to get 200 response from `https://static.crates.io/crates/termcolor/termcolor-1.0.1.crate`, got 504

@bors retry

@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 May 8, 2019
Centril added a commit to Centril/rust that referenced this pull request May 8, 2019
to_xe_bytes for isize and usize returns an array of different size

... on different platforms.

Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature

```
pub fn to_ne_bytes(self) -> [u8; 8]
```

which might be misleading: this function returns 4 bytes on 32-bit
systems.

With this commit applied rustdoc for `isize` and `usize` is this:
<img width="740" alt="2019-04-15_0020" src="https://user-images.githubusercontent.com/28969/56100765-9f69b380-5f14-11e9-974c-daa25edaa881.png">
Centril added a commit to Centril/rust that referenced this pull request May 8, 2019
to_xe_bytes for isize and usize returns an array of different size

... on different platforms.

Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature

```
pub fn to_ne_bytes(self) -> [u8; 8]
```

which might be misleading: this function returns 4 bytes on 32-bit
systems.

With this commit applied rustdoc for `isize` and `usize` is this:
<img width="740" alt="2019-04-15_0020" src="https://user-images.githubusercontent.com/28969/56100765-9f69b380-5f14-11e9-974c-daa25edaa881.png">
Centril added a commit to Centril/rust that referenced this pull request May 8, 2019
to_xe_bytes for isize and usize returns an array of different size

... on different platforms.

Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature

```
pub fn to_ne_bytes(self) -> [u8; 8]
```

which might be misleading: this function returns 4 bytes on 32-bit
systems.

With this commit applied rustdoc for `isize` and `usize` is this:
<img width="740" alt="2019-04-15_0020" src="https://user-images.githubusercontent.com/28969/56100765-9f69b380-5f14-11e9-974c-daa25edaa881.png">
bors added a commit that referenced this pull request May 8, 2019
Rollup of 8 pull requests

Successful merges:

 - #59979 (to_xe_bytes for isize and usize returns an array of different size)
 - #60491 (std: Update compiler-builtins crate)
 - #60550 (Add tests for concrete const types)
 - #60572 (Add test for #59972)
 - #60627 (test for #50518)
 - #60634 (Document + Cleanup lang_items.rs)
 - #60641 (Instead of ICEing on incorrect pattern, use delay_span_bug)
 - #60644 (Use `delay_span_bug` for "Failed to unify obligation")

Failed merges:

r? @ghost
@bors bors merged commit 764e366 into rust-lang:master May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants