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

Clarified code example in char primitive doc #55247

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

peterjoel
Copy link
Contributor

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of collection elements by the item size. This change demonstrates the idea more straightforwardly, without the calculation.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2018
@joshtriplett
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 21, 2018

📌 Commit 0f6e274 has been approved by joshtriplett

@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 Oct 21, 2018
@joshtriplett
Copy link
Member

Nice idea!

@bors
Copy link
Contributor

bors commented Oct 22, 2018

⌛ Testing commit 0f6e274 with merge b3e831083fc773de6ae3e20ee97a389e252c5f7e...

@rust-highfive
Copy link
Collaborator

The job dist-various-1 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.
[01:01:29] CC_armebv7r_none_eabi=arm-none-eabi-gcc
[01:01:29] S=/checkout
[01:01:29] _=/bin/sh
[01:01:29] TOOLSTATE_REPO_ACCESS_TOKEN=[secure]
[01:01:29] TRAVIS=true
[01:01:29] RUST_RELEASE_CHANNEL=nightly
[01:01:29] PATH=/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[01:01:29] RUN_MAKE_TARGETS=thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf
[01:01:29] RUSTC=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc
[01:01:29] RUST_BUILD_STAGE=stage2-thumbv6m-none-eabi
[01:01:29] BOOTSTRAP_PYTHON=/usr/bin/python2.7
[01:01:29] SCRIPT=python2.7 ../x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf src/test/run-make &&       python2.7 ../x.py dist --target asmjs-unknown-emscripten,wasm32-unknown-emscripten,x86_64-rumprun-netbsd,mips-unknown-linux-musl,mipsel-unknown-linux-musl,arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf,armv5te-unknown-linux-gnueabi,armv5te-unknown-linux-musleabi,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl,sparc64-unknown-linux-gnu,x86_64-unknown-redox,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,armebv7r-none-eabi,armebv7r-none-eabihf,armv7r-none-eabi,armv7r-none-eabihf
[01:01:29] AR=ar
[01:01:29] TRAVIS_BRANCH=auto
[01:01:29] RUSTC_BOOTSTRAP=1
[01:01:29] HOST_RPATH_DIR=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib
[01:01:29] SCCACHE_BUCKET=rust-lang-ci-sccache2
[01:01:29] PWD=/checkout/obj
[01:01:29] CI_JOB_NAME=dist-various-1
[01:01:29] TARGET_RPATH_DIR=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/thumbv6m-none-eabi/lib
[01:01:29] LD_LIB_PATH_ENVVAR=LD_LIBRARY_PATH
[01:01:29] PYTHON=/usr/bin/python2.7
[01:01:29] HOME=/home/user
[01:01:29] LD_LIBRARY_PATH=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib
[01:01:29] HOSTNAME=d280420a7dbd
[01:01:29] CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc
[01:01:29] SHLVL=2
[01:01:29] CC= 
[01:01:29] BUILD_DIR=/checkout/obj/build
[01:01:29] BUILD_DIR=/checkout/obj/build
[01:01:29] RUST_TEST_TMPDIR=/checkout/obj/build/tmp
[01:01:29] LLVM_CXXFLAGS=
[01:01:29] RUSTFLAGS=--cap-lints=allow
[01:01:29] STAGING_DIR=/tmp
[01:01:29] TMPDIR=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m
[01:01:29] TARGETS=asmjs-unknown-emscripten,wasm32-unknown-emscripten,x86_64-rumprun-netbsd,mips-unknown-linux-musl,mipsel-unknown-linux-musl,arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf,armv5te-unknown-linux-gnueabi,armv5te-unknown-linux-musleabi,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl,sparc64-unknown-linux-gnu,x86_64-unknown-redox,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf,riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,armebv7r-none-eabi,armebv7r-none-eabihf,armv7r-none-eabi,armv7r-none-eabihf
[01:01:29] RUST_CONFIGURE_ARGS=--musl-root-armv5te=/musl-armv5te       --musl-root-arm=/musl-arm       --musl-root-armhf=/musl-armhf       --musl-root-armv7=/musl-armv7       --musl-root-aarch64=/musl-aarch64       --musl-root-mips=/musl-mips       --musl-root-mipsel=/musl-mipsel       --enable-emscripten       --disable-docs --set build.print-step-timings --enable-verbose-tests --enable-sccache --disable-manage-submodules --enable-locked-deps --enable-cargo-native-static --disable-dist-src --release-channel=nightly --enable-llvm-static-stdcpp --set rust.remap-debuginfo --enable-missing-tools
[01:01:29] MAKEFLAGS=
[01:01:29] MFLAGS=
[01:01:29] BOOTSTRAP_PARENT_ID=1052
[01:01:29] BOOTSTRAP_PARENT_ID=1052
[01:01:29] __COMPAT_LAYER=RunAsInvoker
[01:01:29] CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc
[01:01:29] BUILD=x86_64-unknown-linux-gnu
[01:01:29] CXX= 
[01:01:29] AWS_ACCESS_KEY_ID=AKIAJAMV3QAMMA6AXHFQ
[01:01:29] CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc
[01:01:29] CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc
[01:01:29] CARGO_HOME=/cargo
[01:01:29] RUSTC_LINKER=arm-none-eabi-gcc
[01:01:29] SCCACHE_REGION=us-west-1
[01:01:29] CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc
[01:01:29] LLVM_COMPONENTS=
[01:01:29] TERM=xterm
[01:01:29] MAKELEVEL=1
[01:01:29] mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m
[01:01:29] cd /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m && rm -rf cortex-m
[01:01:29] cd /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/thumb-none-cortex-m/thumb-none-cortex-m && bash -x /checkout/src/test/run-make/thumb-none-cortex-m/../git_clone_sha1.sh cortex-m https://github.com/rust-embedded/cortex-m a448e9156e2cb1e556e5441fd65426952ef4b927 
[01:01:29] Makefile:31: recipe for target 'all' failed
[01:01:29] 
[01:01:29] ------------------------------------------
[01:01:29] stderr:
[01:01:29] stderr:
[01:01:29] ------------------------------------------
[01:01:29] + PROJECT_NAME=cortex-m
[01:01:29] + URL=https://github.com/rust-embedded/cortex-m
[01:01:29] + SHA1=a448e9156e2cb1e556e5441fd65426952ef4b927
[01:01:29] + git clone https://github.com/rust-embedded/cortex-m cortex-m
[01:01:29] Cloning into 'cortex-m'...
[01:01:29] fatal: unable to access 'https://github.com/rust-embedded/cortex-m/': Could not resolve host: github.com
[01:01:29] + err_exit
[01:01:29] + echo ERROR:
[01:01:29] + exit 1
[01:01:29] make: *** [all] Error 1
[01:01:29] ------------------------------------------
[01:01:29] 
[01:01:29] thread '[run-make] run-make/thumb-none-cortex-m' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3284:9
[01:01:29] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[01:01:29] test result: FAILED. 8 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:01:29] 
[01:01:29] 
[01:01:29] 
[01:01:29] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/thumbv6m-none-eabi/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-make" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make" "--stage-id" "stage2-thumbv6m-none-eabi" "--mode" "run-make" "--target" "thumbv6m-none-eabi" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "arm-none-eabi-gcc" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/thumbv6m-none-eabi/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--llvm-version" "8.0.0svn\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:01:29] 
[01:01:29] 
[01:01:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv7em-none-eabihf src/test/run-make
[01:01:29] Build completed unsuccessfully in 0:57:22
---
travis_time:end:115b0e30:start=1540192845415049974,finish=1540192845424320614,duration=9270640
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0db7bc9f
$ 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:1047d07a
travis_time:start:1047d07a
$ 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:0ce9fe42
$ 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
Copy link
Contributor

bors commented Oct 22, 2018

💔 Test failed - status-travis

@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 Oct 22, 2018
@peterjoel peterjoel changed the title Clarified code example inn char primitive doc Clarified code example in char primitive doc Oct 22, 2018
@joshtriplett
Copy link
Member

Looks like this failed due to github's current partial outage.

@kennytm
Copy link
Member

kennytm commented Oct 22, 2018

Although the GitHub outage messed up the bors queue (PR status and CI status become out of sync), this particular failure is caused by travis-ci/travis-ci#9696, not GitHub.

@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 Oct 22, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 23, 2018
…xample, r=joshtriplett

Clarified code example in char primitive doc

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.
kennytm added a commit to kennytm/rust that referenced this pull request Oct 24, 2018
…xample, r=joshtriplett

Clarified code example in char primitive doc

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 25, 2018
…xample, r=joshtriplett

Clarified code example in char primitive doc

The example was not as clear as it could be because it was making an assumption about the structure of the data in order to multiply the number of elements in the slice by the item size. This change demonstrates the idea more straightforwardly, without needing a calculation, by just comparing the size of the slices.
bors added a commit that referenced this pull request Oct 25, 2018
Rollup of 22 pull requests

Successful merges:

 - #53507 (Add doc for impl From for Waker)
 - #53931 (Gradually expanding libstd's keyword documentation)
 - #54965 (update tcp stream documentation)
 - #54977 (Accept `Option<Box<$t:ty>>` in macro argument)
 - #55138 (in which unused-parens suggestions heed what the user actually wrote)
 - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type)
 - #55200 (Documents `From` implementations for `Stdio`)
 - #55245 (submodules: update clippy from 5afdf8b to b1d0343)
 - #55247 (Clarified code example in char primitive doc)
 - #55251 (Fix a typo in the documentation of RangeInclusive)
 - #55253 (only issue "variant of the expected type" suggestion for enums)
 - #55254 (Correct trailing ellipsis in name_from_pat)
 - #55269 (fix typos in various places)
 - #55282 (Remove redundant clone)
 - #55285 (Do some copy editing on the release notes)
 - #55291 (Update stdsimd submodule)
 - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs)
 - #55306 (Regression test for #54478.)
 - #55328 (Fix doc for new copysign functions)
 - #55340 (Operands no longer appear in places)
 - #55345 (Remove is_null)
 - #55348 (Update RELEASES.md after destabilization of non_modrs_mods)

Failed merges:

r? @ghost
@bors bors merged commit 0f6e274 into rust-lang:master Oct 25, 2018
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants