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

Update TRPL to add new Chapter 17: Async and Await #131859

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

chriskrycho
Copy link
Contributor

@chriskrycho chriskrycho commented Oct 17, 2024

  • Add support to rustbook to pass through the -L/--library-path flag to mdbook so that references to the trpl crate
  • Build the trpl crate as part of the book tests. Make it straightforward to add other such book dependencies in the future if needed by implementing that in a fairly general way.
  • Update the submodule for the book to pull in the new chapter on async and await, as well as a number of other fixes. This will happen organically/automatically in a week, too, but this lets me group this change with the next one:
  • Update the compiler messages which reference the existing chapters 17–20, which are now chapters 18-21. There are only two, both previously referencing chapter 18.
  • Update the UI tests which reference the compiler message outputs.

@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2024

r? @cjgillot

rustbot has assigned @cjgillot.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2024

⚠️ Warning ⚠️

  • These commits modify submodules.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2024
@rust-log-analyzer

This comment has been minimized.

@chriskrycho
Copy link
Contributor Author

chriskrycho commented Oct 18, 2024

All right, this is going to be fun to sort out. 😂 In the book crate, the CI run explicitly handles making sure trpl is built and available; it looks like I’ll have to do the same here. However, trpl pulls in tokio (!) and I’m extremely confident (I was wrong! See below) we don’t want rust to depend on tokio. 😬 Much to sort out.

@Noratrieb
Copy link
Member

However, trpl pulls in tokio (!) and I’m extremely confident we don’t want rust to depend on tokio

I'm not quite sure I understand, but I don't see a problem depending on tokio in this repo. It's in the lock file already:

rust/Cargo.lock

Line 5332 in d9c4b8d

[[package]]

@chriskrycho
Copy link
Contributor Author

@Noratrieb Oh, well, that definitely simplifies things a bit then! I had missed that it was there. I just didn’t want to go adding it needlessly, given it is large! We do depend on a specific version in the book repo, but I think that will probably be Fine™ once I get the other bits around the build pipeline sorted out.

Long story short: For the new chapter on async, we built a small crate, trpl, which re-exports items from futures, tokio, and tokio-stream. Many of the examples in the book use those exports. So the rust build and tests need to support that!

I am currently digging into the spot we invoke rustbook to build the crate to figure out what I need to do to make this dance work. Unfortunately, mdbook does not really support external crates in a first-class way, but I think I’ll be able to get it working even so, along similar lines as what I did in the book repo.

(That said, if people have better suggestions on how to do this here, I am all ears!)

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 18, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ehuss
Copy link
Contributor

ehuss commented Oct 23, 2024

Another thing we should probably include here is to add trpl as an unused dependency in rustbook/Cargo.toml. This will help ensure that the trpl dependencies are vendored.

Let me know if you run into any major roadblocks. I dropped the book update from #132007.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label Oct 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2024

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bootstrap side looks good to me, thanks!

@chriskrycho
Copy link
Contributor Author

Thanks, @onur-ozkan! @cjgillot, I think this is ready for your eyes when you get a bit!

chriskrycho and others added 6 commits November 6, 2024 13:58
This also incorporates a number of other changes and fixes which would
normally have been part of the automatic update, but which were blocked
from landing because of the changes required to support shipping a crate
as part of the chapter, along with those changes.
With the insertion of a new chapter 17 on async and await to _The Rust
Programming Language_, references in compiler output to later chapters
need to be updated to avoid confusing users. Redirects exist so that
users who click old links will end up in the right place anyway, but
this way users will be directed to the right URL in the first place.
This makes it possible to test an mdbook which has dependencies other
than the direct crate for the book itself, e.g. the `trpl` crate used in
_The Rust Programming Language_.
Since TRPL now depends on a `trpl` crate, the test needs to be able to
build that crate to run mdbook against it, and also to invoke mdbook
with `--library-path` in that case. Use the support for that flag added
to `rustbook` in the previous change to invoke it with the path to the
dependencies it will need to run `rustdoc` tests which reference `trpl`.

Co-authored-by: Onur Özkan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants