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

Match the loop examples #62957

Open
wants to merge 1 commit into
base: master
from

Conversation

@dns2utf8
Copy link
Contributor

commented Jul 24, 2019

The idea is to show the usefulness of the expression side by side.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jul 24, 2019

r? @aidanhs

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jul 25, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-07-24T22:42:14.1589615Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-07-24T22:42:14.1777084Z ##[command]git config gc.auto 0
2019-07-24T22:42:14.1860029Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-07-24T22:42:14.1917608Z ##[command]git config --get-all http.proxy
2019-07-24T22:42:14.2065017Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/62957/merge:refs/remotes/pull/62957/merge
---
2019-07-24T22:42:51.2581762Z do so (now or later) by using -b with the checkout command again. Example:
2019-07-24T22:42:51.2581789Z 
2019-07-24T22:42:51.2581980Z   git checkout -b <new-branch-name>
2019-07-24T22:42:51.2582006Z 
2019-07-24T22:42:51.2582061Z HEAD is now at dc77d92f8 Merge 38ca20f911706c65cbdb96154aa9119381d453dc into 03f19f7ff128a3b01eeab3f87f04cce22883f006
2019-07-24T22:42:51.2724017Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-07-24T22:42:51.2726986Z ==============================================================================
2019-07-24T22:42:51.2727053Z Task         : Bash
2019-07-24T22:42:51.2727094Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-24T23:39:23.3090283Z .................................................................................................... 200/5851
2019-07-24T23:39:27.3038369Z .................................................................................................... 300/5851
2019-07-24T23:39:31.3957779Z .................................................................................................... 400/5851
2019-07-24T23:39:35.0645651Z .................................................................................................... 500/5851
2019-07-24T23:39:38.6449870Z ........................................................................i........................... 600/5851
2019-07-24T23:39:47.3305005Z .................................................................................................... 800/5851
2019-07-24T23:39:52.8476794Z .................................................................................................... 900/5851
2019-07-24T23:39:57.5802246Z ...................................................................................................i 1000/5851
2019-07-24T23:39:57.5802246Z ...................................................................................................i 1000/5851
2019-07-24T23:40:02.8590431Z ...........i........................................................................................ 1100/5851
2019-07-24T23:40:06.6072059Z .............................iiiii.................................................................. 1200/5851
2019-07-24T23:40:12.3353305Z .................................................................................................... 1400/5851
2019-07-24T23:40:14.9204668Z .................................................................................................... 1500/5851
2019-07-24T23:40:18.5613882Z .................................................................................................... 1600/5851
2019-07-24T23:40:21.0695305Z .................................................................................................... 1700/5851
2019-07-24T23:40:21.0695305Z .................................................................................................... 1700/5851
2019-07-24T23:40:24.2832194Z .....................................................................i.............................. 1800/5851
2019-07-24T23:40:32.4884491Z .................................................................................................... 2000/5851
2019-07-24T23:40:36.5990987Z .................................................................................................... 2100/5851
2019-07-24T23:40:40.1160007Z .................................................................................................... 2200/5851
2019-07-24T23:40:40.1160007Z .................................................................................................... 2200/5851
2019-07-24T23:40:43.9256489Z .....................................................i.............................................. 2300/5851
2019-07-24T23:40:53.1991751Z .................................................................................................... 2500/5851
2019-07-24T23:40:57.2233385Z .................................................................................................... 2600/5851
2019-07-24T23:41:02.1818516Z .................................................................................................... 2700/5851
2019-07-24T23:41:05.8942507Z .................................................................................................... 2800/5851
2019-07-24T23:41:05.8942507Z .................................................................................................... 2800/5851
2019-07-24T23:41:10.1137954Z .................................................................................................... 2900/5851
2019-07-24T23:41:15.0378195Z .................................................................................................... 3000/5851
2019-07-24T23:41:19.3225485Z .................................................................................................... 3100/5851
2019-07-24T23:41:24.3801113Z .................................................................................................... 3200/5851
2019-07-24T23:41:27.9590307Z .................................................................................................... 3300/5851
2019-07-24T23:41:31.4675304Z .................................................................................................... 3400/5851
2019-07-24T23:41:36.4229141Z .................................................................................................... 3500/5851
2019-07-24T23:41:40.0713093Z ....................i............................................................................... 3600/5851
2019-07-24T23:41:44.1174128Z ..............................................................................................ii...i 3700/5851
2019-07-24T23:41:47.9557039Z ..ii................................................................................................ 3800/5851
2019-07-24T23:41:56.3007695Z .................................................................................................... 4000/5851
2019-07-24T23:41:56.3007695Z .................................................................................................... 4000/5851
2019-07-24T23:41:59.9447938Z ........ii.......................................................................................... 4100/5851
2019-07-24T23:42:01.8801936Z .............................i...................................................................... 4200/5851
2019-07-24T23:42:03.8064133Z ................................................................................................i... 4300/5851
2019-07-24T23:42:10.1115651Z .................................................................................................... 4500/5851
2019-07-24T23:42:27.0028320Z .................................................................................................... 4600/5851
2019-07-24T23:42:30.4625327Z .................................................................................................... 4700/5851
2019-07-24T23:42:34.0708154Z .................................................................................................... 4800/5851
---
2019-07-24T23:43:06.0722324Z .................................................................................................... 5400/5851
2019-07-24T23:43:09.8270120Z .................................................................................................... 5500/5851
2019-07-24T23:43:13.7947148Z .................................................................................................... 5600/5851
2019-07-24T23:43:16.7817365Z .................................................................................................... 5700/5851
2019-07-24T23:43:19.7355893Z ...........................................................................................i........ 5800/5851
2019-07-24T23:43:21.4539865Z test result: ok. 5830 passed; 0 failed; 21 ignored; 0 measured; 0 filtered out
2019-07-24T23:43:21.4539903Z 
2019-07-24T23:43:21.4616466Z  finished in 253.280
2019-07-24T23:43:21.4802483Z Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:43:21.4802483Z Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:43:21.6896866Z 
2019-07-24T23:43:21.6897037Z running 2905 tests
2019-07-24T23:43:36.0067043Z .................................................................................................... 100/2905
2019-07-24T23:43:50.9413429Z ............................................................................i....................... 200/2905
2019-07-24T23:44:14.6089445Z .................................................................................................... 400/2905
2019-07-24T23:44:26.2130766Z .................................................................................................... 500/2905
2019-07-24T23:44:40.3154406Z .................................................................................................... 600/2905
2019-07-24T23:45:01.4494778Z .................................................................................................... 700/2905
2019-07-24T23:45:01.4494778Z .................................................................................................... 700/2905
2019-07-24T23:45:15.0518282Z .................................................................................................... 800/2905
2019-07-24T23:45:25.9072389Z .................................................................................................... 900/2905
2019-07-24T23:45:43.3314295Z .................................................................................................... 1000/2905
2019-07-24T23:45:57.0567320Z .................................................................................................... 1100/2905
2019-07-24T23:46:07.7846220Z .................................................................................................... 1200/2905
2019-07-24T23:46:19.6244091Z .................................................................................................... 1300/2905
2019-07-24T23:46:35.1945340Z .......ii........................................................................................... 1400/2905
2019-07-24T23:46:47.1833463Z .................................................................................................... 1500/2905
2019-07-24T23:46:59.5210504Z ...........................................................i.......i................................ 1600/2905
2019-07-24T23:47:32.3009594Z .................................................................................................... 1800/2905
2019-07-24T23:47:32.3009594Z .................................................................................................... 1800/2905
2019-07-24T23:47:47.9307502Z ...........................................................................................i........ 1900/2905
2019-07-24T23:48:17.4690577Z ...............................................................i.................................... 2000/2905
2019-07-24T23:49:01.5310250Z .................................................................................................... 2200/2905
2019-07-24T23:49:15.6433188Z ..................................................................................................ii 2300/2905
2019-07-24T23:49:34.3559860Z .................................................................................................... 2400/2905
2019-07-24T23:49:47.7864614Z .................................................................................................... 2500/2905
---
2019-07-24T23:52:03.2747744Z  finished in 34.174
2019-07-24T23:52:03.2950168Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:03.4678486Z 
2019-07-24T23:52:03.4678949Z running 146 tests
2019-07-24T23:52:06.7923825Z i....iii......iii..iiii....i............................i..i................i....i.........ii.i.i..i 100/146
2019-07-24T23:52:08.7453774Z iii..............i.........iii.i......ii......
2019-07-24T23:52:08.7454327Z 
2019-07-24T23:52:08.7456314Z  finished in 5.450
2019-07-24T23:52:08.7623061Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:08.9093664Z 
2019-07-24T23:52:08.9093664Z 
2019-07-24T23:52:08.9093893Z running 39 tests
2019-07-24T23:52:11.0789449Z i.........i......................i.....
2019-07-24T23:52:11.0792155Z 
2019-07-24T23:52:11.0792714Z  finished in 2.317
2019-07-24T23:52:11.0972100Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:11.2577080Z 
2019-07-24T23:52:11.2577080Z 
2019-07-24T23:52:11.2579082Z running 9 tests
2019-07-24T23:52:11.2582501Z iiiiiiiii
2019-07-24T23:52:11.2583241Z 
2019-07-24T23:52:11.2583376Z  finished in 0.161
2019-07-24T23:52:11.2787958Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:11.4460630Z 
---
2019-07-24T23:52:29.5761599Z  finished in 18.297
2019-07-24T23:52:29.5936498Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:29.7367165Z 
2019-07-24T23:52:29.7367303Z running 122 tests
2019-07-24T23:52:52.4348749Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
2019-07-24T23:52:56.7600473Z .i.i......iii.i.....ii
2019-07-24T23:52:56.7601451Z 
2019-07-24T23:52:56.7603613Z  finished in 27.166
2019-07-24T23:52:56.7610319Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:52:56.7610917Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-07-24T23:56:26.5265538Z     Finished release [optimized] target(s) in 2m 33s
2019-07-24T23:56:26.5534857Z Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-07-24T23:56:26.7155430Z 
2019-07-24T23:56:26.7155984Z running 315 tests
2019-07-24T23:57:40.9009191Z ....................................i............................................................... 100/315
2019-07-24T23:58:46.9281133Z ....................................................i............................................... 200/315
2019-07-24T23:59:59.1136985Z ...............
2019-07-24T23:59:59.1138062Z test result: ok. 313 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
2019-07-24T23:59:59.1138344Z 
2019-07-24T23:59:59.1143441Z  finished in 212.561
---
2019-07-25T00:03:49.7444104Z 
2019-07-25T00:03:49.7541389Z 
2019-07-25T00:03:49.7541495Z running 444 tests
2019-07-25T00:04:08.8883428Z .................................................................................................... 100/444
2019-07-25T00:04:25.0624741Z ...................................................................................i................ 200/444
2019-07-25T00:04:53.4706246Z .................................................................................................... 400/444
2019-07-25T00:04:59.8209507Z ............................................
2019-07-25T00:04:59.8209653Z test result: ok. 443 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
2019-07-25T00:04:59.8209857Z 
---
2019-07-25T00:06:13.0804543Z running 961 tests
2019-07-25T00:06:13.0941545Z .................................................................................................... 100/961
2019-07-25T00:06:13.1038675Z .................................................................................................... 200/961
2019-07-25T00:06:13.1148283Z .................................................................................................... 300/961
2019-07-25T00:06:13.1982823Z ............................................................................................ii...... 400/961
2019-07-25T00:06:13.3112930Z .................................................................................................... 600/961
2019-07-25T00:06:13.3221358Z .................................................................................................... 700/961
2019-07-25T00:06:13.3432801Z .................................................................................................... 800/961
2019-07-25T00:06:13.8113431Z .................................................................................................... 900/961
2019-07-25T00:06:13.8113431Z .................................................................................................... 900/961
2019-07-25T00:06:14.8557057Z .............................................................
2019-07-25T00:06:14.8558532Z test result: ok. 959 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
2019-07-25T00:06:14.8559200Z 
2019-07-25T00:06:14.8562489Z    Doc-tests core
2019-07-25T00:06:18.6049036Z 
2019-07-25T00:06:18.6049873Z running 2379 tests
2019-07-25T00:06:30.6673164Z ......iiiii......................................................................................... 100/2379
2019-07-25T00:06:42.4080989Z .........................................................................ii......................... 200/2379
2019-07-25T00:06:55.5389456Z ...............................................................................................i.... 300/2379
2019-07-25T00:07:10.6434671Z .................................................................................................... 400/2379
2019-07-25T00:07:21.5012060Z ..............................i..i.................iiii............................................. 500/2379
2019-07-25T00:07:43.8245168Z .................................................................................................... 700/2379
2019-07-25T00:07:55.1870732Z .................................................................................................... 800/2379
2019-07-25T00:08:06.6312625Z .................................................................................................... 900/2379
2019-07-25T00:08:18.2164249Z .................................................................................................... 1000/2379
---
2019-07-25T00:10:01.4387924Z .................................................................................................... 1900/2379
2019-07-25T00:10:14.3660794Z .................................................................................................... 2000/2379
2019-07-25T00:10:26.5333854Z .................................................................................................... 2100/2379
2019-07-25T00:10:41.0721493Z .................................................................................................... 2200/2379
2019-07-25T00:10:56.3941689Z ........................................................................................i........... 2300/2379
2019-07-25T00:11:06.0606988Z test result: ok. 2364 passed; 0 failed; 15 ignored; 0 measured; 0 filtered out
2019-07-25T00:11:06.0607015Z 
2019-07-25T00:11:06.0883012Z  finished in 366.253
2019-07-25T00:11:06.0884142Z Testing panic_abort stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
2019-07-25T00:13:13.0428353Z 
2019-07-25T00:13:13.0428653Z running 1009 tests
2019-07-25T00:13:35.7675705Z i................................................................................................... 100/1009
2019-07-25T00:13:48.2296518Z .................................................................................................... 200/1009
2019-07-25T00:13:56.5491414Z .................iii......i......i...i......i....................................................... 300/1009
2019-07-25T00:14:01.0420708Z .................................................................................................... 400/1009
2019-07-25T00:14:08.2884846Z ................................i..i.............F............................iiii.......ii......... 500/1009
2019-07-25T00:14:22.1821498Z .................................................................................................... 700/1009
2019-07-25T00:14:22.1821498Z .................................................................................................... 700/1009
2019-07-25T00:14:29.8946829Z ...................................iiii............................................................. 800/1009
2019-07-25T00:14:45.3690562Z .................................................................................................... 900/1009
2019-07-25T00:14:53.2317380Z .........................................................iiii....................................... 1000/1009
2019-07-25T00:14:53.6198961Z failures:
2019-07-25T00:14:53.6198990Z 
2019-07-25T00:14:53.6198990Z 
2019-07-25T00:14:53.6199693Z ---- keyword_docs.rs - loop_keyword (line 678) stdout ----
2019-07-25T00:14:53.6199743Z error: expected expression, found `;`
2019-07-25T00:14:53.6200136Z   --> keyword_docs.rs:690:10
2019-07-25T00:14:53.6200241Z 15 |     i *= ;
2019-07-25T00:14:53.6200278Z    |          ^ expected expression
2019-07-25T00:14:53.6200304Z 
2019-07-25T00:14:53.6200357Z error: aborting due to previous error
---
2019-07-25T00:14:53.6200952Z 
2019-07-25T00:14:53.6401285Z error: test failed, to rerun pass '--doc'
2019-07-25T00:14:53.6416778Z 
2019-07-25T00:14:53.6417401Z 
2019-07-25T00:14:53.6418566Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "2" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
2019-07-25T00:14:53.6418881Z 
2019-07-25T00:14:53.6418909Z 
2019-07-25T00:14:53.6432555Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-07-25T00:14:53.6475555Z Build completed unsuccessfully in 1:25:53
2019-07-25T00:14:53.6475555Z Build completed unsuccessfully in 1:25:53
2019-07-25T00:14:54.2034834Z ##[error]Bash exited with code '1'.
2019-07-25T00:14:54.2071612Z ##[section]Starting: Checkout
2019-07-25T00:14:54.2073805Z ==============================================================================
2019-07-25T00:14:54.2073880Z Task         : Get sources
2019-07-25T00:14:54.2073929Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Centril

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

Can you please elaborate on this change and why it should be done?

@dns2utf8

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2019

Certainly, when I read the last example it was confusing me that the algorithm demonstrated was not the same.
So I matched them and picked the one with a little more complexity.

@dns2utf8 dns2utf8 force-pushed the dns2utf8:doc_loop_keyword branch from 38ca20f to ccc3b66 Jul 26, 2019

@dns2utf8

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2019

A more explicit variant would be this:

let mut i = 1;
let mut something = 0;
loop {
    println!("i is {}", i);
    if i > 100 {
        something = i;
        break;
    }
    i *= 2;
}
assert_eq!(something, 128);
@edmilsonefs

This comment has been minimized.

Copy link

commented Jul 30, 2019

Hey! This is a ping from triage, we would like to know if you @aidanhs could give us a few minutes to share your thoughts on it.

@dns2utf8 dns2utf8 force-pushed the dns2utf8:doc_loop_keyword branch from ccc3b66 to ae1e7ca Aug 6, 2019

@dns2utf8

This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2019

I rebased the branch on the current master.
Do you think the example should be more explicit?
Or are there other opinions?

Cheers,
Stefan

@Alexendoo

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

Ping from triage: Requesting a review from @rust-lang/docs

@dns2utf8

This comment has been minimized.

Copy link
Contributor Author

commented Aug 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.