Repository navigation
Translate Rust Patterns book into Russian, update the repository from upstream - #2
Merged
Merged
Conversation
The GitHub Pages URL was only referenced indirectly via the repo's About section, which is hard to find on mobile. Added a direct clickable link.
- Retarget C# companion links from missing source-docs paths to book SUMMARYs.
- Fix type-driven correctness intro to link Rust Patterns source, not index.html.
- Resolve static file paths under site/ with canonicalization and percent-decoding.
- Match xtask landing page blurbs to the root README.
[fix] fix a typo in ch07-1
…nk-to-readme Add GitHub Pages link directly in README (closes #8)
Fixed github links
Fix typos
Fix mermaid chart in ch05-data-structures-and-collections.md
Remove obsolete comment in `LendingIterator` code example
fix(docs, xtask): repair cross-book links and harden local serve
I know, it's tiny, but foo won't compile, right?
This fixes technical accuracy issues, most notably in the C# book. There are other minor tweaks, including simplying technical jargon in the type-drive-correctness book.
…clarify expectations
Fix broken navigation links in C/C++ book introduction
Update ch03-built-in-types.md
…oyment Found repo, no pages deployed
…prove benchmark fairness
The sum of squares from 0 to 9,999,999 (~3.33e20) exceeds u64::MAX (~1.84e19), causing a panic in debug mode with 'attempt to add with overflow'. Reduce n from 10_000_000 to 3_000_000 so the result (~9e18) fits in u64, keeping the focus on parallelism demonstration without introducing u128. Fixes microsoft#111
…ow-111 fix(python-book): prevent u64 overflow in cpu_work threading example
…ng-107 fix(rust-patterns-book): make Lifetime Branding example enforce compile-time safety
python-book/ch02: Fixes graph order in "Creating Your First Project" section
Use mermaid entity code #quot; for double quotes inside node labels instead of escaped quotes which caused parse errors.
fix(csharp-book): fix mermaid syntax error in ch14 FFI diagram
Multi-stage build: mdbook + mdbook-mermaid compile all seven books via 'cargo xtask build' in a Rust builder stage; an unprivileged nginx stage serves the static output. No Rust toolchain or sources in the final image. Opt-in and self-contained under docker/ — the supported local development path remains 'cargo xtask serve'. Includes a build-only CI job so the Dockerfile cannot silently rot.
…ment Add optional Docker deployment for self-hosting (microsoft#115)
fix(python-book): improve mermaid diagrams ordering and readability
Rust renamed the concept in 1.84. The Reference, rustdoc and the compiler all use "dyn compatibility" now — E0038 reads "the trait `X` is not dyn compatible". Pure terminology change, no technical content touched. Also fixes an internal inconsistency in async-book ch10, where line 80 already said "not dyn-compatible" while line 143 still said "not object-safe". Ref: https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…atibility The rule said "No use of `Self` in return position (except via indirection like `Box<Self>`)". Both halves were wrong: 1. The restriction is not limited to return position. The Reference says a dispatchable method must "not use `Self` except in the type of the receiver" — argument position counts too. That's why `PartialEq` (`fn eq(&self, other: &Self)`) is not dyn compatible, which the old wording could not explain. 2. `Box<Self>` is not an escape hatch in return position. `Box<Self>` is a valid *receiver* (`self: Box<Self>`); as a return type it still names `Self` and is rejected. The real idiom is `-> Box<dyn Trait>`, which names a concrete type rather than `Self`. Verified against rustc 1.95.0; the compiler emits two distinct messages, "references the `Self` type in its return type" and "references the `Self` type in this parameter", both quoted in the examples. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…t valid receivers
The rule said "No associated functions (methods must have `&self`,
`&mut self`, or `self`)". Wrong on both counts:
1. Associated functions with no receiver ARE allowed — they just have to be
opted out of the vtable with `where Self: Sized`. rustc itself suggests
this fix in the E0038 note.
2. `self` by value is not a dispatchable receiver: it implies
`where Self: Sized`. A trait with a `self`-by-value method is still dyn
compatible; the method is merely absent from the vtable. Calling it
through the trait object fails with E0161 ("cannot move a value of type
`dyn Consume`"), not E0038 — a different failure mode worth showing.
Replaces the wrong list with the actual set of dispatchable receivers:
`&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`,
`self: Pin<P>`. All six verified dispatching through a trait object on
rustc 1.95.0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…mpatibility tip The rule of thumb said "no `Sized` bounds", three lines after the "Workarounds" block that recommends exactly `where Self: Sized`. The two are different things: `Sized` as a supertrait kills dyn compatibility outright (E0038, "...because it requires `Self: Sized`"), whereas `where Self: Sized` on one method removes just that method from the vtable and keeps the trait usable. Both verified on rustc 1.95.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…n dispatchable methods Rule 2 said "No generic type parameters on methods", which is correct but incomplete. The Reference is explicit: a dispatchable method must "not have any type parameters (although lifetime parameters are allowed)". Readers routinely assume `fn first_token<'a>(&self, s: &'a str) -> &'a str` breaks dyn compatibility because it has angle brackets. It doesn't — lifetimes are erased before codegen, so one vtable slot still suffices. Verified on rustc 1.95.0, including a higher-ranked closure argument. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two Reference rules were missing or loosely worded: - "All supertraits must also be dyn compatible." Added as rule 5. It's worth its own entry because the failure is non-local: your trait looks fine and the compiler blames a method in somebody else's trait. - Rule 1 restated as "`Sized` must not be a supertrait", matching the Reference, instead of "No `Self: Sized` bound on the trait itself" — which reads as if it also covered per-method `where Self: Sized` bounds. Verified on rustc 1.95.0: `trait Derived: Base` where `Base` has a receiverless associated function yields E0038 pointing at `Base::make`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two more Reference rules the chapter didn't list: a dyn compatible trait "must not have any associated constants" and "must not have any associated types with generics". The GAT one matters here in particular — the chapter teaches GATs a few sections earlier with a `LendingIterator` example, without mentioning that such a trait can never become `dyn LendingIterator`. Cross-referenced. Also records something the Reference leaves implicit and that readers will try by analogy with methods: there is no `where Self: Sized` opt-out for an associated constant. `const MAX: f64 where Self: Sized;` doesn't compile at all on stable — E0658, generic const items are experimental (rust#113521). The workaround is to turn the constant into a method. Plus the E0191 note: a plain associated type keeps the trait dyn compatible but must be specified in the trait object type. All verified on rustc 1.95.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…nc fn / impl Trait)
Last of the missing Reference rules: a dispatchable method must "not have an
opaque return type", covering both `async fn` and return-position
`impl Trait`.
This one is load-bearing for this chapter specifically. The RPITIT section
below presents `fn items(&self) -> impl Iterator<Item = &str>` as a strict
improvement over `Box<dyn Iterator>` ("RPITIT removes the allocation")
without mentioning that it also removes the option of `dyn Container`. Added
a cross-reference in both directions, plus one to async-book ch10, which
already covers the `Pin<Box<dyn Future>>` workaround.
Also folds in the `AsyncFn`/`AsyncFnMut`/`AsyncFnOnce` rule, but explains it
rather than restating it: rustc blames `AsyncFnMut::CallRefFuture<'a>`, so
it's a corollary of the GAT rule, not an independent special case. The
contrast with plain `Fn` (dyn compatible) makes the point concrete.
Verified on rustc 1.95.0 — both still rejected, and both workarounds
exercised through a real trait object.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…rename
Readers will meet "object safe" everywhere outside this book — older
articles, crate docs, Stack Overflow — and there is nothing in the chapter
telling them it's the same concept under a different name.
Follows the chapter's existing habit of anchoring features to versions
("Since Rust 1.65", "Since Rust 1.75"), and explains why the term changed:
Rust has no OOP objects, and the property was never about memory safety.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…actions Pin GitHub Actions to full-length commit SHAs
Bumps the github-actions group with 6 updates: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `4.4.0` | `7.0.1` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.12.0` | `4.3.0` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `6.19.2` | `7.3.0` | | [actions/cache](https://github.com/actions/cache) | `5.1.0` | `6.1.0` | | [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) | `4.0.0` | `5.0.0` | | [actions/deploy-pages](https://github.com/actions/deploy-pages) | `5.0.0` | `5.0.1` | Updates `actions/checkout` from 4.4.0 to 7.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4.4.0...3d3c42e) Updates `docker/setup-buildx-action` from 3.12.0 to 4.3.0 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@8d2750c...37fe631) Updates `docker/build-push-action` from 6.19.2 to 7.3.0 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@10e90e3...53b7df9) Updates `actions/cache` from 5.1.0 to 6.1.0 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@caa2961...55cc834) Updates `actions/upload-pages-artifact` from 4.0.0 to 5.0.0 - [Release notes](https://github.com/actions/upload-pages-artifact/releases) - [Commits](actions/upload-pages-artifact@7b1f4a7...fc324d3) Updates `actions/deploy-pages` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](actions/deploy-pages@cd2ce8f...368f825) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/setup-buildx-action dependency-version: 4.3.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/build-push-action dependency-version: 7.3.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/cache dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/upload-pages-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/deploy-pages dependency-version: 5.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
…erminology docs: object safety → dyn compatibility, and fix the rule list in rust-patterns-book ch02
…ions/github-actions-ede9422954 build(deps): bump the github-actions group with 6 updates
Retranslate every chapter of rust-patterns-book/src from the English source. Prose, headings, tables, diagram labels, code comments and user-facing strings are in Russian; identifiers, code structure, file names and compiler output are unchanged. Also: - Align chapter headings and cross-references with the file numbering (chapters 9-16 were numbered one lower in the source), and add the functional/imperative chapter (8) to the table of contents and the pacing table. - Point internal links at the real chapter filenames. - Put toml/bash snippets in ch13 and ch15 inside proper code fences. - Translate the book title in book.toml and set language to ru. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Merge upstream/main (278f1d7) into the translation branch. Non-translated books take upstream content as-is. The translated books and README keep the Russian text, with upstream changes ported by hand: - rust-patterns-book: dyn compatibility rewrite in ch02, new lending/ opaque-type examples, arena example in ch04, new safety notes in ch05, ch06, ch12, ch19, numbering and mermaid label fixes in ch08, table escapes in ch07, const fn float rules and Cache capacity guard in ch01. - type-driven-correctness-book: Curry-Howard wording replaced with "types as guarantees" in ch01 and ch13, Haskell GADT asides removed from ch02, HealthValue definition added to ch07, SAFETY comments in ch09, mermaid <br/> labels in ch03, ch07, ch18. - README: Pages links, Binary Musings entry, pinned mdbook versions, clone section, deploy branch main. - book.toml: upstream repo URL in both books; type-driven title and language translated to match rust-patterns. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.