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

Merged
merged 7 commits into from
Nov 24, 2024

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.

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Nov 23, 2024
Update TRPL to add new Chapter 17: Async and Await

- 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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#127483 (Allow disabling ASan instrumentation for globals)
 - rust-lang#131505 (use `confstr(_CS_DARWIN_USER_TEMP_DIR, ...)` as a `TMPDIR` fallback on Darwin)
 - rust-lang#132949 (Add specific diagnostic for using macro_rules macro as attribute/derive)
 - rust-lang#133247 (Reduce integer `Display` implementation size)
 - rust-lang#133286 (Re-delay a resolve `bug` related to `Self`-ctor in patterns)
 - rust-lang#133332 (Mark `<[T; N]>::as_mut_slice` with the `const` specifier.)
 - rust-lang#133366 (Remove unnecessary bool from `ExpectedFound::new`)

Failed merges:

 - rust-lang#131859 (Update TRPL to add new Chapter 17: Async and Await)

r? `@ghost`
`@rustbot` modify labels: rollup
@jieyouxu
Copy link
Member

@bors r- (needs a rebase)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 23, 2024
chriskrycho and others added 7 commits November 23, 2024 08:57
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 <onurozkan.dev@outlook.com>
Without this change:

    $ ./x test --set build.vendor=true src/doc/book
    # (lots of output)
    error: failed to select a version for the requirement `futures = "^0.3"` (locked to 0.3.30)
    candidate versions found which didn't match: 0.3.31, 0.3.27
    location searched: directory source `/Users/chris/dev/rust-lang/rust/vendor` (which is replacing registry `crates-io`)
    required by package `trpl v0.2.0 (/Users/chris/dev/rust-lang/rust/src/doc/book/packages/trpl)`
    perhaps a crate was updated and forgotten to be re-vendored?
    Build completed unsuccessfully in 0:01:19

With this change:

    $ ./x test --set build.vendor=true src/doc/book
    # (lots of build output)
    Testing stage1 mdbook src/doc/book (aarch64-apple-darwin)
        finished in 86.949 seconds
    Build completed successfully in 0:04:05

# Conflicts:
#	src/bootstrap/src/core/build_steps/vendor.rs
@chriskrycho
Copy link
Contributor Author

@jieyouxu I rebased.

@jieyouxu
Copy link
Member

@bors r=onur-ozkan
@bors rollup=never (modifies book test step)
@bors p=1 (looks conflict-prone)

@bors
Copy link
Contributor

bors commented Nov 23, 2024

📌 Commit 7630b49 has been approved by onur-ozkan

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 23, 2024
@jieyouxu
Copy link
Member

I guess the p didn't work...
@bors p=1

@bors
Copy link
Contributor

bors commented Nov 23, 2024

⌛ Testing commit 7630b49 with merge e48241b...

@bors
Copy link
Contributor

bors commented Nov 24, 2024

☀️ Test successful - checks-actions
Approved by: onur-ozkan
Pushing e48241b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 24, 2024
@bors bors merged commit e48241b into rust-lang:master Nov 24, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 24, 2024
compiler-errors pushed a commit to compiler-errors/rust that referenced this pull request Nov 24, 2024
Update TRPL to add new Chapter 17: Async and Await

- 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.
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e48241b): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -3.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-3.6%, -3.6%] 1
All ❌✅ (primary) - - 0

Cycles

Results (primary 4.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.0% [4.0%, 4.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.0% [4.0%, 4.0%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 797.977s -> 797.356s (-0.08%)
Artifact size: 336.34 MiB -> 336.34 MiB (0.00%)

@chriskrycho chriskrycho deleted the update-trpl branch November 24, 2024 20:02
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 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. 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.