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

Autogenerate stubs and SUMMARY.md in the unstable book #42612

Merged
merged 5 commits into from
Jun 16, 2017

Conversation

est31
Copy link
Member

@est31 est31 commented Jun 12, 2017

Removes a speed bump in compiler development by autogenerating stubs for features in the unstable book. See #42454 for discussion.

The PR contains three commits, separated in order to make review easy:

  • The first commit converts the tidy tool from a binary crate to a crate that contains both a library and a binary. In the second commit, we'll use the tidy library
  • The second and main commit introduces autogeneration of SUMMARY.md and feature stub files
  • The third commit turns off the tidy lint that checks for features without a stub, and removes the stub files. A separate commit due to the large number of files touched

Members of the doc team who wish to document some features can either do this (where $rustsrc is the root of the rust repo git checkout):

  1. cd to $rustsrc/src/tools/unstable-book-gen and then do cargo run $rustsrc/src $rustsrc/src/doc/unstable-book to put the stubs into the unstable book
  2. cd to $rustsrc and run git ls-files --others --exclude-standard to list the newly added stubs
  3. choose a file to edit, then git add it and git commit
  4. afterwards, remove all changes by the tool by doing git --reset hard and git clean -f

Or they can do this:

  1. remove the comment marker in src/tools/tidy/src/unstable_book.rs line 122
  2. run ./x.py test src/tools/tidy to list the unstable features which only have stubs
  3. revert the change in 1
  4. document one of the chosen unstable features

The changes done by this PR also allow for further development:

  • tidy obtains information about tracking issues. We can now forbid differing tracking issues between differing #![unstable] annotations. I haven't done this but plan to in a future PR
  • we now have a general framework for generating stuff for the unstable book at build time. Further changes can autogenerate a list of the API a given library feature exposes.

The old way to simply click through the documentation after it has been uploaded to rust-lang.org works as well.

r? @nagisa

Fixes #42454

@steveklabnik
Copy link
Member

steveklabnik commented Jun 12, 2017

/cc @rust-lang/docs @rust-lang/compiler

@est31
Copy link
Member Author

est31 commented Jun 12, 2017

About the stubs removal, I think its better to track stubs outside of git, so that changes of the template affect all of them. Also, the methods listed above only work for stubs tracked outside of git, if you want to add docs for a feature when stubs are inside git you need to open docs one by one and check for stubs. If there is desire to put them into git though, I can put them back!

I have done a new tool instead of adding this to tidy because I think that tidy shouldn't change anything, only read. Also, often you forget to run tidy so the speed bump issue would only be resolved partially, while this runs on every docs run.

@nagisa
Copy link
Member

nagisa commented Jun 12, 2017

Okay, so I’m not sure how the unstable book generated/built/deployed, so I cannot r+ without checking what the people in-the-know say.

All the other changes r=me.

@est31
Copy link
Member Author

est31 commented Jun 12, 2017

how is the unstable book generated/built/deployed

I was assuming it was some form of ./x.py doc. It outputs to build/$TARGET/doc/unstable-book/ and continues to work fine (I've tested ./x.py doc --stage 0).

@est31
Copy link
Member Author

est31 commented Jun 13, 2017

I cannot r+ without checking what the people in-the-know say.

Okay then ... cc @alexcrichton

@alexcrichton
Copy link
Member

@bors: r=nagisa

build system stuff all looks good to me!

@bors
Copy link
Contributor

bors commented Jun 13, 2017

📌 Commit d0b3afa has been approved by nagisa

@arielb1 arielb1 added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 13, 2017
bors added a commit that referenced this pull request Jun 14, 2017
Rollup of 6 pull requests

- Successful merges: #42408, #42428, #42496, #42597, #42636, #42638
- Failed merges: #42612
@bors
Copy link
Contributor

bors commented Jun 14, 2017

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

Convert tidy into a library so that the data it creates
can be used by external tools.
@est31
Copy link
Member Author

est31 commented Jun 14, 2017

Rebased. re-r? @nagisa

@est31
Copy link
Member Author

est31 commented Jun 14, 2017

@bors p=1 due to hazard of breaking again.

@alexcrichton
Copy link
Member

@bors: r=nagisa p=1

@bors
Copy link
Contributor

bors commented Jun 14, 2017

📌 Commit e69f908 has been approved by nagisa

@bors
Copy link
Contributor

bors commented Jun 14, 2017

⌛ Testing commit e69f908 with merge 7336555...

@bors
Copy link
Contributor

bors commented Jun 14, 2017

💔 Test failed - status-travis

@est31
Copy link
Member Author

est31 commented Jun 14, 2017

Seems like a legit issue.

[00:47:18] Generating unstable book md files (x86_64-unknown-linux-gnu)

[00:47:18] thread 'main' panicked at 'source "/checkout/obj/build/x86_64-unknown-fuchsia/md-doc/unstable-book" failed to get metadata: No such file or directory (os error 2)', /checkout/src/build_helper/lib.rs:176

[00:47:18] note: Run with `RUST_BACKTRACE=1` for a backtrace.

[00:47:18] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --target x86_64-unknown-fuchsia,aarch64-unknown-fuchsia

I'm investigating...

@est31
Copy link
Member Author

est31 commented Jun 14, 2017

Hmm I couldn't reproduce locally, nor could I get fuchsia working... I have pushed a debug commit (don't merge the PR with that) to try it.

@bors try

@bors
Copy link
Contributor

bors commented Jun 14, 2017

⌛ Trying commit 1173ec8 with merge ae3a043...

bors added a commit that referenced this pull request Jun 14, 2017
Autogenerate stubs and SUMMARY.md in the unstable book

Removes a speed bump in compiler development by autogenerating stubs for features in the unstable book. See #42454 for discussion.

The PR contains three commits, separated in order to make review easy:

* The first commit converts the tidy tool from a binary crate to a crate that contains both a library and a binary. In the second commit, we'll use the tidy library
* The second and main commit introduces autogeneration of SUMMARY.md and feature stub files
* The third commit turns off the tidy lint that checks for features without a stub, and removes the stub files. A separate commit due to the large number of files touched

Members of the doc team who wish to document some features can either do this (where `$rustsrc` is the root of the rust repo git checkout):

1. cd to `$rustsrc/src/tools/unstable-book-gen` and then do `cargo run $rustsrc/src $rustsrc/src/doc/unstable-book` to put the stubs into the unstable book
2. cd to `$rustsrc` and run `git ls-files --others --exclude-standard` to list the newly added stubs
3. choose a file to edit, then `git add` it and `git commit`
4. afterwards, remove all changes by the tool by doing `git --reset hard` and `git clean -f`

Or they can do this:

1. remove the comment marker in `src/tools/tidy/src/unstable_book.rs` line 122
2. run `./x.py test src/tools/tidy` to list the unstable features which only have stubs
3. revert the change in 1
3. document one of the chosen unstable features

The changes done by this PR also allow for further development:

* tidy obtains information about tracking issues. We can now forbid differing tracking issues between differing `#![unstable]` annotations. I haven't done this but plan to in a future PR
* we now have a general framework for generating stuff for the unstable book at build time. Further changes can autogenerate a list of the API a given library feature exposes.

r? @nagisa

Fixes #42454
@est31
Copy link
Member Author

est31 commented Jun 14, 2017

Hmm, I've still got to learn how to use bors try...

@bors try

@bors
Copy link
Contributor

bors commented Jun 14, 2017

⌛ Trying commit 9ec3645 with merge f2b20f7...

@aidanhs aidanhs removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 15, 2017
@est31 est31 force-pushed the master branch 4 times, most recently from 71cda1a to b8b4bab Compare June 15, 2017 13:22
@est31
Copy link
Member Author

est31 commented Jun 15, 2017

Yeey it works!

@est31
Copy link
Member Author

est31 commented Jun 15, 2017

re-r? @nagisa

@nagisa
Copy link
Member

nagisa commented Jun 15, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Jun 15, 2017

📌 Commit 23bd80a has been approved by nagisa

@bors
Copy link
Contributor

bors commented Jun 15, 2017

⌛ Testing commit 23bd80a with merge 552c58c...

@bors
Copy link
Contributor

bors commented Jun 15, 2017

💔 Test failed - status-travis

@Mark-Simulacrum
Copy link
Member

Failure looks legitimate.

[00:47:18] Generating unstable book md files (x86_64-unknown-linux-gnu)
[00:47:18] thread 'main' panicked at 'source "/checkout/obj/build/x86_64-unknown-fuchsia/md-doc/unstable-book" failed to get metadata: No such file or directory (os error 2)', /checkout/src/build_helper/lib.rs:176
[00:47:18] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:18] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --target x86_64-unknown-fuchsia,aarch64-unknown-fuchsia
[00:47:18] Build completed unsuccessfully in 0:46:12

@est31
Copy link
Member Author

est31 commented Jun 16, 2017

Okay. Travis passed now. I've squashed the fix commits. re-r? @nagisa

@nagisa
Copy link
Member

nagisa commented Jun 16, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Jun 16, 2017

📌 Commit b34ac5d has been approved by nagisa

@bors
Copy link
Contributor

bors commented Jun 16, 2017

⌛ Testing commit b34ac5d with merge b40be00...

bors added a commit that referenced this pull request Jun 16, 2017
Autogenerate stubs and SUMMARY.md in the unstable book

Removes a speed bump in compiler development by autogenerating stubs for features in the unstable book. See #42454 for discussion.

The PR contains three commits, separated in order to make review easy:

* The first commit converts the tidy tool from a binary crate to a crate that contains both a library and a binary. In the second commit, we'll use the tidy library
* The second and main commit introduces autogeneration of SUMMARY.md and feature stub files
* The third commit turns off the tidy lint that checks for features without a stub, and removes the stub files. A separate commit due to the large number of files touched

Members of the doc team who wish to document some features can either do this (where `$rustsrc` is the root of the rust repo git checkout):

1. cd to `$rustsrc/src/tools/unstable-book-gen` and then do `cargo run $rustsrc/src $rustsrc/src/doc/unstable-book` to put the stubs into the unstable book
2. cd to `$rustsrc` and run `git ls-files --others --exclude-standard` to list the newly added stubs
3. choose a file to edit, then `git add` it and `git commit`
4. afterwards, remove all changes by the tool by doing `git --reset hard` and `git clean -f`

Or they can do this:

1. remove the comment marker in `src/tools/tidy/src/unstable_book.rs` line 122
2. run `./x.py test src/tools/tidy` to list the unstable features which only have stubs
3. revert the change in 1
3. document one of the chosen unstable features

The changes done by this PR also allow for further development:

* tidy obtains information about tracking issues. We can now forbid differing tracking issues between differing `#![unstable]` annotations. I haven't done this but plan to in a future PR
* we now have a general framework for generating stuff for the unstable book at build time. Further changes can autogenerate a list of the API a given library feature exposes.

The old way to simply click through the documentation after it has been uploaded to rust-lang.org works as well.

r? @nagisa

Fixes #42454
@bors
Copy link
Contributor

bors commented Jun 16, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nagisa
Pushing b40be00 to master...

@bors bors merged commit b34ac5d into rust-lang:master Jun 16, 2017
@Mark-Simulacrum Mark-Simulacrum mentioned this pull request Jun 16, 2017
10 tasks
est31 added a commit to est31/rust that referenced this pull request Jun 18, 2017
Its being autogenerated now, as of PR rust-lang#42612.
It seems I forgot to remove it.
bors added a commit that referenced this pull request Jun 19, 2017
Remove SUMMARY.md of the unstable book as its autogenerated

Its being autogenerated now, as of PR #42612.
It seems I forgot to remove it.

Also, sort the entries of SUMMARY.md alphabetically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants