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 stubs to keyword docs #60817

Merged
merged 1 commit into from
May 17, 2019
Merged

Add stubs to keyword docs #60817

merged 1 commit into from
May 17, 2019

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented May 14, 2019

Resolves #60779.

This commit gives each stable keyword a short entry in the "Keywords" section in the docs for std. The newly added entries are only a single line each and contain the main purpose of the keyword. I changed some of the existing summary lines for consistency's sake. Each line is either an imperative ("name the type of a trait object" for dyn), or an object ("An abstract data type" for enum). I tried to avoid using the keyword itself or the word "keyword" in the summary.

Later commits can flesh out each keyword with an example for each context in which it can appear as well as a link to the appropriate part of the rust book.

edit:
Here's the list of keywords and summaries (sans formatting) to ease reviewing. I'll try to keep this up to date as I make changes:

keyword summary
Self The implementing type within a trait or impl block, or the current type within a type definition.
as Cast between types, or rename an import.
async ExperimentalReturn a Future instead of blocking the current thread.
await ExperimentalSuspend execution until the result of a Future is ready.
break Exit early from a loop.
const Compile-time constants and deterministic functions.
continue Skip to the next iteration of a loop.
crate A Rust binary or library.
dyn Name the type of a trait object.
else What to do when an if condition does not hold.
enum A type that can be any one of several variants.
extern Link to or import external code.
false A value of type bool representing logical false.
fn A function or function pointer.
for Iteration with in, trait implementation with impl, or higher-ranked trait bounds (for<'a>).
if Evaluate a block if a condition holds.
impl Implement some functionality for a type.
in Iterate over a series of values with for.
let Bind a value to a variable.
loop Loop indefinitely.
match Control flow based on pattern matching.
mod Organize code into modules.
move Capture a closure's environment by value.
mut A mutable binding, reference, or pointer.
pub Make an item visible to others.
ref Bind by reference during pattern matching.
return Return a value from a function.
self The receiver of a method, or the current module.
static A place that is valid for the duration of a program.
struct A type that is composed of other types.
super The parent of the current module.
trait A common interface for a class of types.
true A value of type bool representing logical true.
type Define an alias for an existing type.
union The Rust equivalent of a C-style union.
unsafe Code or interfaces whose memory safety cannot be verified by the type system.
use Import or rename items from other crates or modules.
where Add constraints that must be upheld to use an item.
while Loop while a condition is upheld.

@rust-highfive
Copy link
Collaborator

r? @shepmaster

(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 May 14, 2019
@ecstatic-morse
Copy link
Contributor Author

r? @petrochenkov

@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:16db2b7e:start=1557827296584271534,finish=1557827297344107671,duration=759836137
$ 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:42] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:42] tidy error: /checkout/src/libstd/keyword_docs.rs:860: TODO is deprecated; use FIXME
[00:04:47] some tidy checks failed
[00:04:47] 
[00:04:47] 
[00:04:47] 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:47] 
[00:04:47] 
[00:04:47] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:47] Build completed unsuccessfully in 0:01:12
[00:04:47] Build completed unsuccessfully in 0:01:12
[00:04:47] make: *** [tidy] Error 1
[00:04:47] Makefile:67: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1407b7a5
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 14 09:53:16 UTC 2019
---
travis_time:end:222d9e12:start=1557827597163396995,finish=1557827597169113527,duration=5716532
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0872c3b0
$ 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:22bcaba6
travis_time:start:22bcaba6
$ 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:071cd900
$ 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)

@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:179a9e56:start=1557829011799816242,finish=1557829012537681079,duration=737864837
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:19:33] 
[01:19:33] running 143 tests
[01:19:36] i..iii.....iii..iiii.....i......................i...i................i.....i..........ii.i..i..i.ii. 100/143
[01:19:37] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:19:37] 
[01:19:37]  finished in 4.608
[01:19:37] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:19:39] 
[01:19:39] running 9 tests
[01:19:39] iiiiiiiii
[01:19:39] 
[01:19:39]  finished in 0.148
[01:19:39] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:19:55] 
[01:19:55] running 122 tests
[01:20:20] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:20:25] .i.i......iii.i.....ii
[01:20:25] 
[01:20:25]  finished in 30.530
[01:20:25] travis_fold:end:test_debuginfo

---
[01:41:43] travis_fold:end:stage0-linkchecker

[01:41:43] travis_time:end:stage0-linkchecker:start=1557835124511247893,finish=1557835126474664071,duration=1963416178

[01:41:44] std/keyword.mod.html:1: broken link - book/ch07-02-modules-and-use-to-control-scope-and-privacy.html
[01:41:45] std/keyword.super.html:1: broken link - book/ch07-02-modules-and-use-to-control-scope-and-privacy.html
[01:41:45] std/index.html:295: broken link - book/ch07-02-modules-and-use-to-control-scope-and-privacy.html
[01:41:45] std/index.html:304: broken link - book/ch07-02-modules-and-use-to-control-scope-and-privacy.html
[01:41:51] thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:41:9
[01:41:51] 
[01:41:51] 
[01:41:51] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
[01:41:51] expected success, got: exit code: 101
[01:41:51] expected success, got: exit code: 101
[01:41:51] 
[01:41:51] 
[01:41:51] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:41:51] Build completed unsuccessfully in 0:34:00
[01:41:51] Makefile:48: recipe for target 'check' failed
[01:41:51] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1775d9fe
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 14 11:58:55 UTC 2019

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)

@shepmaster
Copy link
Member

/cc @rust-lang/docs

@shepmaster shepmaster added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label May 14, 2019
src/libstd/keyword_docs.rs Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
@shepmaster
Copy link
Member

I have general unease over the amount of duplication between this content, TRPL, and the reference.

@petrochenkov
Copy link
Contributor

My point in #60779 is that if the main documentation page has a keyword list, then the list should be correct (perhaps with stubs).

Whether placing the keyword docs on that page is a good idea or not is a separate question.
I don't know. I remember I was weakly against when #51140 first appeared, but I don't care too much, I guess.

@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:11421b7b:start=1557854123005599575,finish=1557854125028189446,duration=2022589871
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:43] 
[01:21:43] running 143 tests
[01:21:45] i..iii.....iii..iiii.....i......................i..i.................i.....i..........ii.i..i..i.ii. 100/143
[01:21:47] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:21:47] 
[01:21:47]  finished in 4.469
[01:21:47] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:49] 
[01:21:49] running 9 tests
[01:21:49] iiiiiiiii
[01:21:49] 
[01:21:49]  finished in 0.145
[01:21:49] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:22:04] 
[01:22:04] running 122 tests
[01:22:27] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:22:32] .i.i......iii.i.....ii
[01:22:32] 
[01:22:32]  finished in 28.270
[01:22:32] travis_fold:end:test_debuginfo

---
[01:43:26] travis_fold:end:stage0-linkchecker

[01:43:26] travis_time:end:stage0-linkchecker:start=1557860339911112823,finish=1557860341993826775,duration=2082713952

[01:43:28] std/keyword.mod.html:1: absolute path - /nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:28] std/keyword.super.html:1: absolute path - /nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:28] std/index.html:295: absolute path - /nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:28] std/index.html:304: absolute path - /nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:34] thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:41:9
[01:43:34] 
[01:43:34] 
[01:43:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
[01:43:34] expected success, got: exit code: 101
[01:43:34] expected success, got: exit code: 101
[01:43:34] 
[01:43:34] 
[01:43:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:43:34] Build completed unsuccessfully in 0:33:18
[01:43:34] Makefile:48: recipe for target 'check' failed
[01:43:34] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0c61f24f
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 14 18:59:10 UTC 2019

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)

@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:15a82df0:start=1557862127582414182,finish=1557862129782117609,duration=2199703427
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:07] 
[01:21:07] running 143 tests
[01:21:10] i..iii.....iii..iiii.....i......................i...i................i.....i..........ii.i..i..i.ii. 100/143
[01:21:12] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:21:12] 
[01:21:12]  finished in 4.666
[01:21:12] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:14] 
[01:21:14] running 9 tests
[01:21:14] iiiiiiiii
[01:21:14] 
[01:21:14]  finished in 0.160
[01:21:14] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:30] 
[01:21:30] running 122 tests
[01:21:55] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:22:01] .i.i......iii.i.....ii
[01:22:01] 
[01:22:01]  finished in 30.903
[01:22:01] travis_fold:end:test_debuginfo

---
[01:43:41] travis_fold:end:stage0-linkchecker

[01:43:41] travis_time:end:stage0-linkchecker:start=1557868360863827443,finish=1557868362967510108,duration=2103682665

[01:43:43] std/keyword.mod.html:1: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:43] std/keyword.super.html:1: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:44] std/index.html:295: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:44] std/index.html:304: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:49] thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:41:9
[01:43:49] 
[01:43:49] 
[01:43:49] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
[01:43:49] expected success, got: exit code: 101
[01:43:49] expected success, got: exit code: 101
[01:43:49] 
[01:43:49] 
[01:43:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:43:49] Build completed unsuccessfully in 0:34:42
[01:43:49] make: *** [check] Error 1
[01:43:49] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:058a62ba
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 14 21:12:51 UTC 2019

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)

src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

petrochenkov commented May 14, 2019

By using literal stubs instead of summaries you could both resolve #60779 and avoid @Centril's comments :)
But I guess it's too late to turn back now.

@petrochenkov
Copy link
Contributor

r=me once @Centril's concerns are resolved.

r? @Centril

@petrochenkov
Copy link
Contributor

It would be good to add a paragraph explicitly saying that the doc is not yet written and inviting the reader to make a PR for the keywords with missing documentation body.

@ecstatic-morse
Copy link
Contributor Author

@petrochenkov These summary lines are visible on doc.rust-lang.org/stable/std, so they should at least have a uniform style. I considered:

  1. Making all keyword summary lines empty (not sure if it's possible to have no summary line but still have documentation).
  2. Leaving the existing summary lines alone and adding empty ones (looks ugly, not uniform).
  3. Using "The x keyword" for all keywords (uninformative and repetitive).
  4. Writing new summary lines in the style of std and getting the bikeshedding over with.

The last one seemed least bad.

@petrochenkov
Copy link
Contributor

The last one seemed least bad.

It's not even less bad, it's certainly better in the long run!

@ecstatic-morse
Copy link
Contributor Author

@petrochenkov Will do. How about:

"The documentation for this keyword is not yet complete. Pull requests welcome!"

@Centril
Copy link
Contributor

Centril commented May 14, 2019

Seems good to me.

@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:1c24a794:start=1557872641057319656,finish=1557872644671779500,duration=3614459844
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:30] 
[01:21:30] running 143 tests
[01:21:33] i..iii.....iii..iiii.....i......................i...i................i......i.........ii.i..i..i.ii. 100/143
[01:21:35] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:21:35] 
[01:21:35]  finished in 4.988
[01:21:35] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:38] 
[01:21:38] running 9 tests
[01:21:38] iiiiiiiii
[01:21:38] 
[01:21:38]  finished in 0.161
[01:21:38] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:21:53] 
[01:21:53] running 122 tests
[01:22:18] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:22:22] .i.i......iii.i.....ii
[01:22:22] 
[01:22:22]  finished in 29.344
[01:22:22] travis_fold:end:test_debuginfo

---
[01:43:44] travis_fold:end:stage0-linkchecker

[01:43:44] travis_time:end:stage0-linkchecker:start=1557878877600547153,finish=1557878879729506202,duration=2128959049

[01:43:46] std/keyword.mod.html:1: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:46] std/keyword.super.html:1: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:47] std/index.html:295: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:47] std/index.html:304: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/nightly/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
[01:43:52] thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:41:9
[01:43:52] 
[01:43:52] 
[01:43:52] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
[01:43:52] expected success, got: exit code: 101
[01:43:52] expected success, got: exit code: 101
[01:43:52] 
[01:43:52] 
[01:43:52] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:43:52] Build completed unsuccessfully in 0:34:15
[01:43:52] Makefile:48: recipe for target 'check' failed
[01:43:52] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0dbfaa88
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed May 15 00:08:08 UTC 2019

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)

src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented May 15, 2019

Btw, when you're done with changes altogether, can you squash things into a single commit? (also please avoid @-mentioning folks in commits cause it generates many emails ^^).

@ecstatic-morse ecstatic-morse force-pushed the issue-60779 branch 2 times, most recently from 0161fb7 to 7c4f161 Compare May 15, 2019 01:59
@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented May 15, 2019

I added Self to the list of keywords, added a note about the incomplete docs and a link to #34601, squashed, resolved most of the ongoing discussions, and reduced noise in Centril's inbox.

Note that there's still some reserved or nightly only keywords that don't appear on this list (async and await are present but try and default are not).

src/libstd/keyword_docs.rs Outdated Show resolved Hide resolved
@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:087ab5dc:start=1557885636902207577,finish=1557885725018605259,duration=88116397682
$ 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
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:18:49] 
[01:18:49] running 143 tests
[01:18:52] i..iii.....iii..iiii.....i......................i..i.................i.....i..........ii.i..i..i.ii. 100/143
[01:18:54] test result: ok. 113 passed; 0 failed; 30 ignored; 0 measured; 0 filtered out
[01:18:54] 
[01:18:54]  finished in 4.594
[01:18:54] travis_fold:end:test_codegen
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:18:56] 
[01:18:56] running 9 tests
[01:18:56] iiiiiiiii
[01:18:56] 
[01:18:56]  finished in 0.154
[01:18:56] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:19:11] 
[01:19:11] running 122 tests
[01:19:36] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:19:41] .i.i......iii.i.....ii
[01:19:41] 
[01:19:41]  finished in 29.659
[01:19:41] travis_fold:end:test_debuginfo

---
[01:41:04] travis_fold:end:stage0-linkchecker

[01:41:04] travis_time:end:stage0-linkchecker:start=1557891796973844216,finish=1557891798993551479,duration=2019707263

[01:41:07] std/keyword.union.html:1: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/reference/items/unions.html
[01:41:07] std/index.html:309: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/reference/items/unions.html
[01:41:12] thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:41:9
[01:41:12] 
[01:41:12] 
[01:41:12] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/linkchecker" "/checkout/obj/build/x86_64-unknown-linux-gnu/doc"
[01:41:12] expected success, got: exit code: 101
[01:41:12] expected success, got: exit code: 101
[01:41:12] 
[01:41:12] 
[01:41:12] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:41:12] Build completed unsuccessfully in 0:34:01
[01:41:12] Makefile:48: recipe for target 'check' failed
[01:41:12] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00078169
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed May 15 03:43:27 UTC 2019

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)

@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented May 16, 2019

I fixed the broken doc link and noted that Self can also refer to "the current type within a type definition", and changed the wording of for and unsafe.

This commit gives each stable keyword a short entry in the "Keywords"
section in the docs for `std`. The newly added entries are a single
summary line and a note that the documentation is not yet complete.  I
changed some of the existing summary lines for consistency's sake. Each
line is either a verb phrase ("name the type of a trait object" for
`dyn`), or an object ("A value of type `bool` representing logical true"
for `true`). I tried to avoid using the keyword itself or the word
"keyword" in the summary.

Later PRs can flesh out each keyword with an example of each
context in which a keyword can appear and a link to the rust book.

Keywords which are not close to stable rust such as `box` (which is
getting unstabilized) or `try` are ignored in this PR.
@Centril
Copy link
Contributor

Centril commented May 16, 2019

r=me with green travis :)

@Centril
Copy link
Contributor

Centril commented May 17, 2019

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 17, 2019

📌 Commit 851be33 has been approved by Centril

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

bors commented May 17, 2019

⌛ Testing commit 851be33 with merge c2e49bf...

bors added a commit that referenced this pull request May 17, 2019
Add stubs to keyword docs

Resolves #60779.

This commit gives each stable keyword a short entry in the "Keywords" section in the docs for `std`. The newly added entries are only a single line each and contain the main purpose of the keyword. I changed some of the existing summary lines for consistency's sake. Each line is either an imperative ("name the type of a trait object" for `dyn`), or an object ("An abstract data type" for `enum`). I tried to avoid using the keyword itself or the word "keyword" in the summary.

Later commits can flesh out each keyword with an example for each context in which it can appear as well as a link to the appropriate part of the rust book.

**edit:**
Here's the list of keywords and summaries (sans formatting) to ease reviewing. I'll try to keep this up to date as I make changes:

keyword | summary
-- | --
Self | The implementing type within a `trait` or `impl` block, or the current type within a type definition.
as | Cast between types, or rename an import.
async | ExperimentalReturn a Future instead of blocking the current thread.
await | ExperimentalSuspend execution until the result of a Future is ready.
break | Exit early from a loop.
const | Compile-time constants and deterministic functions.
continue | Skip to the next iteration of a loop.
crate | A Rust binary or library.
dyn | Name the type of a trait object.
else | What to do when an if condition does not hold.
enum | A type that can be any one of several variants.
extern | Link to or import external code.
false | A value of type bool representing logical false.
fn | A function or function pointer.
for | Iteration with in, trait implementation with impl, or higher-ranked trait bounds (for<'a>).
if | Evaluate a block if a condition holds.
impl | Implement some functionality for a type.
in | Iterate over a series of values with for.
let | Bind a value to a variable.
loop | Loop indefinitely.
match | Control flow based on pattern matching.
mod | Organize code into modules.
move | Capture a closure's environment by value.
mut | A mutable binding, reference, or pointer.
pub | Make an item visible to others.
ref | Bind by reference during pattern matching.
return | Return a value from a function.
self | The receiver of a method, or the current module.
static | A place that is valid for the duration of a program.
struct | A type that is composed of other types.
super | The parent of the current module.
trait | A common interface for a class of types.
true | A value of type bool representing logical true.
type | Define an alias for an existing type.
union | The Rust equivalent of a C-style union.
unsafe | Code or interfaces whose memory safety cannot be verified by the type system.
use | Import or rename items from other crates or modules.
where | Add constraints that must be upheld to use an item.
while | Loop while a condition is upheld.
@bors
Copy link
Contributor

bors commented May 17, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Centril
Pushing c2e49bf to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 17, 2019
@bors bors merged commit 851be33 into rust-lang:master May 17, 2019
@ecstatic-morse ecstatic-morse deleted the issue-60779 branch October 6, 2020 01:42
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 merged-by-bors This PR was explicitly merged by bors. 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.

Add stubs for keywords not documented in https://doc.rust-lang.org/std/#keywords yet
8 participants