Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/blog/async/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ written against individual
runtimes](https://github.com/rust-lang/areweasyncyet.rs/issues/34). Writing your
async code in a runtime-agnostic fashion requires [conditional
compilation](https://github.com/launchbadge/sqlx/blob/d0fbe7feff4b3a200cf0453417d5e53bd011643a/sqlx-core/src/rt/mod.rs#L116-L136),
[compatibility layers](https://docs.rs/async-compat/latest/async_compat) and
[compatibility layers](https://docs.rs/async-compat/latest/async_compat/) and
[handling
edge-cases](https://github.com/seanmonstar/reqwest/issues/719#issuecomment-558758637).

Expand Down Expand Up @@ -480,7 +480,7 @@ async Rust. Learn to walk before you run.

If you have to use async Rust, stick to Tokio and well-established libraries
like [reqwest](https://github.com/seanmonstar/reqwest) and
[sqlx](https://github.com/launchbadge/sqlx).
[sqlx](https://github.com/transact-rs/sqlx).

While it may seem surprising given the context of this article, we can't
overlook Tokio's stronghold within the ecosystem. A vast majority of libraries
Expand Down
2 changes: 1 addition & 1 deletion content/blog/bugs-rust-wont-catch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ GNU coreutils has shipped CVEs in every single one of those categories. Take a p
- `od --strings -N` writes a NUL byte past a heap buffer (9.8, 2025)
- `sort` 1-byte read before a heap buffer with a `SIZE_MAX` key offset (9.8, 2025)
- `ls -Z` and `ls -l` crashes with SELinux but no xattr support (9.7, 2025)
- `split --line-bytes` heap overwrite ([CVE-2024-0684](https://nvd.nist.gov/vuln/detail/CVE-2024-0684), 9.5, 2024)
- `split --line-bytes` heap overwrite ([CVE-2024-0684](https://nvd.nist.gov/vuln/detail/cve-2024-0684), 9.5, 2024)
- `b2sum --check` reads unallocated memory on malformed input (9.4, 2023)
- `tail -f` stack buffer overrun with many files and a high `ulimit -n` (9.0, 2021)

Expand Down
14 changes: 7 additions & 7 deletions content/blog/defensive-programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ template = "article.html"
series = "Idiomatic Rust"
reviews = [
{ name = "Tyler Stevens", url = "https://www.linkedin.com/in/tpstevens/" },
{ name = "kat", url = "https://www.sakurakat.systems/" },
{ name = "kat", url = "https://sakurakat.systems/" },
]
resources = [
"[Making illegal states unrepresentable](/blog/illegal-state/)",
Expand Down Expand Up @@ -701,12 +701,12 @@ Here are the most relevant ones:

| Lint | Description |
|------|-------------|
| [`clippy::indexing_slicing`](https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing) | Prevents direct indexing into slices and vectors |
| [`clippy::fallible_impl_from`](https://rust-lang.github.io/rust-clippy/master/index.html#fallible_impl_from) | Warns about `From` implementations that can panic and should be `TryFrom` instead. |
| [`clippy::wildcard_enum_match_arm`](https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm) | Disallows wildcard `_` patterns. |
| [`clippy::unneeded_field_pattern`](https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_field_pattern) | Identifies when you're ignoring too many struct fields with `..` unnecessarily. |
| [`clippy::fn_params_excessive_bools`](https://rust-lang.github.io/rust-clippy/master/index.html#fn_params_excessive_bools) | Warns when a function has too many boolean parameters (4 or more by default). |
| [`clippy::must_use_candidate`](https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate) | Suggests adding `#[must_use]` to types that are good candidates for it. |
| [`clippy::indexing_slicing`](https://clippy.rust-lang.org/master/index.html#indexing_slicing) | Prevents direct indexing into slices and vectors |
| [`clippy::fallible_impl_from`](https://clippy.rust-lang.org/master/index.html#fallible_impl_from) | Warns about `From` implementations that can panic and should be `TryFrom` instead. |
| [`clippy::wildcard_enum_match_arm`](https://clippy.rust-lang.org/master/index.html#wildcard_enum_match_arm) | Disallows wildcard `_` patterns. |
| [`clippy::unneeded_field_pattern`](https://clippy.rust-lang.org/master/index.html#unneeded_field_pattern) | Identifies when you're ignoring too many struct fields with `..` unnecessarily. |
| [`clippy::fn_params_excessive_bools`](https://clippy.rust-lang.org/master/index.html#fn_params_excessive_bools) | Warns when a function has too many boolean parameters (4 or more by default). |
| [`clippy::must_use_candidate`](https://clippy.rust-lang.org/master/index.html#must_use_candidate) | Suggests adding `#[must_use]` to types that are good candidates for it. |

You can enable these in your project by adding them at the top of your crate, e.g.

Expand Down
2 changes: 1 addition & 1 deletion content/blog/dont-use-preludes-and-globs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ As you can see, the list of downsides is long. The only upside is that it saves

**Pro tips:**

- Enable the [clippy lint for wildcard imports](https://rust-lang.github.io/rust-clippy/master/index.html#/wildcard_imports) to catch glob imports in your code.
- Enable the [clippy lint for wildcard imports](https://clippy.rust-lang.org/master/index.html#/wildcard_imports) to catch glob imports in your code.
- If you really want to create a prelude, at least use it for traits and macros only, not for types. Extending behavior of existing types (like adding a `par_iter` method to iterators with Rayon) is an acceptable use case for preludes if used in moderation. To avoid naming conflicts, consider using a unique prefix for extension traits like `CrateNameHashmapExt` instead of `HashMapExt`.
- If you depend on a crate which has a prelude, consider not using it and instead importing the types you need explicitly. This way, you can avoid conflicts down the road and make it easier to see where a type comes from.

Expand Down
2 changes: 1 addition & 1 deletion content/blog/dyn-compatibility/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,6 @@ If you do, too, here are some resources to dig deeper:
- 2023-12-28: [Rust 1.75.0](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0/) - Stabilized `async fn` and return-position `impl Trait` in traits (though such traits still aren't dyn compatible)
- 2025-01-09: [Rust 1.84.0](https://blog.rust-lang.org/2025/01/09/Rust-1.84.0/) - The docs had moved from "object safety" to "dyn compatibility" around this release cycle; the [tracking issue](https://github.com/rust-lang/rust/issues/130852#issuecomment-2947417189) notes that the rename unfortunately missed the release notes.

The lang team also wants a "practical path" to call `async fn`s through `dyn Trait` natively. It's on the [2026 project goals](https://github.com/rust-lang/rfcs/blob/master/text/3935-Project-Goals-2026.md), so the async gotcha above should ease over time.
The lang team also wants a "practical path" to call `async fn`s through `dyn Trait` natively. It's on the [2026 project goals](https://github.com/rust-lang/rfcs/blob/main/text/3935-Project-Goals-2026.md), so the async gotcha above should ease over time.

{{ <next_steps context="Stuck choosing between generics, trait objects, and enums? I can help you work through the tradeoffs in your own APIs." source="dyn-compatibility" /> }}
2 changes: 1 addition & 1 deletion content/blog/foundational-software/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ You can sit with us.

> We are committed to providing a friendly, safe and welcoming environment for all
>
> -- [The Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct)
> -- [The Rust Code of Conduct](https://rust-lang.org/policies/code-of-conduct/)

That is also where the idea for corrode comes from:
To cut through red tape in the industry.
Expand Down
6 changes: 3 additions & 3 deletions content/blog/hardening-rust/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Be explicit about whether a failure may take down a single task, a single thread

Never panic in an uncontrolled manner.

If you maintain a library, you have less control over where your code runs and what a panic can take down. Consider enabling stricter Clippy lints such as [`indexing_slicing`](https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing) and [`arithmetic_side_effects`](https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects) to catch common panic sources before they become part of your public API. Those lints can be noisy in applications, but they are often useful when panic freedom matters more than convenience.
If you maintain a library, you have less control over where your code runs and what a panic can take down. Consider enabling stricter Clippy lints such as [`indexing_slicing`](https://clippy.rust-lang.org/master/index.html#indexing_slicing) and [`arithmetic_side_effects`](https://clippy.rust-lang.org/master/index.html#arithmetic_side_effects) to catch common panic sources before they become part of your public API. Those lints can be noisy in applications, but they are often useful when panic freedom matters more than convenience.

## Observing Failures With Panic Hooks

Expand Down Expand Up @@ -334,7 +334,7 @@ fn factorial(n: u64) -> u64 {
The problem is that recursion can quickly exhaust stack space.

If you allow users to call this function with large inputs, it might crash your program.
[Rust does not guarantee tail-call optimization on stable Rust](https://weitzel.dev/blog/rustlang-trampoline/). Some compilers and languages can turn certain tail-recursive functions into loops, but you should not rely on that transformation in Rust. If recursion depth depends on user input or external data, rewrite the algorithm iteratively or put an explicit bound on the depth.
[Rust does not guarantee tail-call optimization on stable Rust](https://weitzel.dev/blog/rustlang-trampoline/index.html). Some compilers and languages can turn certain tail-recursive functions into loops, but you should not rely on that transformation in Rust. If recursion depth depends on user input or external data, rewrite the algorithm iteratively or put an explicit bound on the depth.

It takes some experience, but for recursive algorithms where you're not in control of the input size, it's often safer to use an iterative approach:

Expand Down Expand Up @@ -435,7 +435,7 @@ Even if your service is compromised, the attacker has very limited tools at thei

My recommendation is [Google's distroless images](https://github.com/GoogleContainerTools/distroless), but please do your own research[^distroless] as I'm not an expert on this.

[^distroless]: Data sources I found useful for this topic include [this post](https://www.minimus.io/post/best-distroless-image-alternatives-2026) and [this comparison](https://safeguard.sh/resources/blog/distroless-vs-chainguard-vs-wolfi-base-images).
[^distroless]: Data sources I found useful for this topic include [this post](https://www.echo.ai/blog/best-distroless-image-alternatives) and [this comparison](https://safeguard.sh/resources/blog/distroless-vs-chainguard-vs-wolfi-base-images).

Distroless images are minimal Debian-based images stripped of everything unnecessary, while still including TLS certificates and a non-root user.
For a typical Rust web service, start with `gcr.io/distroless/cc-debian13:nonroot`: it includes the C runtime libraries that a normal Debian-built Rust binary may dynamically link against, but no shell or package manager.
Expand Down
8 changes: 4 additions & 4 deletions content/blog/hiring-rust-engineers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ The problem shows up when less experienced Rust developers try to get hired. In

When I talk to teams about Rust, one concern comes up again and again: "Can we even hire for this?" Behind that question is usually a fear that the community is too small.

I don't think that matches the data. The Rust community has more than tripled in size over the past two years and now has [3.7M users, with 0.6M joining in the last six months alone.](https://www.developernation.net/resources/reports/state-of-the-developer-nation-24th-edition-q1-2023)
I don't think that matches the data. The Rust community has more than tripled in size over the past two years and now has [3.7M users, with 0.6M joining in the last six months alone.](https://www.developernation.net/resources/reports/state-of-the-developer-nation-24th-edition-q1-2023/)

<a href="https://www.developernation.net/resources/reports/state-of-the-developer-nation-24th-edition-q1-2023" target="_blank">
<a href="https://www.developernation.net/resources/reports/state-of-the-developer-nation-24th-edition-q1-2023/" target="_blank">
<img src="communities.svg" class="invert" alt="Programming Language Communities Size">
</a>

The hiring problem is real, but I think companies often look in the wrong place. Teams that have not adopted Rust worry that nobody is available. Teams that already use Rust in production often find that Rust attracts engineers who want to work with the language. If you're still weighing Rust for your organization, see [Why Rust in Production](/blog/why-rust/).

The [season 1 finale of the Rust in Production podcast](/podcast/s01e07-season-finale/?t=23%3A06) had two examples. Paul Dix, Founder and CTO of [InfluxData](https://www.influxdata.com/), said InfluxData received a lot of inbound interest after announcing that its new database core was written in Rust. Micah Wylde, Founder of [Arroyo](https://arroyo.dev/), said Rust helped a small company stand out because people wanted to work with it.
The [season 1 finale of the Rust in Production podcast](/podcast/s01e07-season-finale/?t=23%3A06) had two examples. Paul Dix, Founder and CTO of [InfluxData](https://www.influxdata.com/), said InfluxData received a lot of inbound interest after announcing that its new database core was written in Rust. Micah Wylde, Founder of [Arroyo](https://www.arroyo.dev/), said Rust helped a small company stand out because people wanted to work with it.

I wrote this guide because I keep seeing companies make the same hiring mistakes. Hiring managers and team leads can use it to tighten job posts and interviews before concluding that Rust talent is impossible to find.

Expand Down Expand Up @@ -70,7 +70,7 @@ The hard part is fit. Location rules and salary range can filter out otherwise g

For a larger candidate pool, sponsor Rust-focused events, [conferences](/blog/rust-conferences-2025/), or [podcasts](/podcast). Sponsorship is still underused, and it puts your company in front of people who already care about Rust.

Post jobs where Rust developers already look. Good starting points are [Filtra.io](https://filtra.io/rust), [RustJobs.dev](https://rustjobs.dev/), [RustJobs.fyi](https://www.rustjobs.fyi/), and [RemoteOK](https://remoteok.com/remote-rust-jobs). The monthly "Who is hiring?" threads on [Hacker News](https://news.ycombinator.com/) and [Reddit](https://www.reddit.com/r/rust/comments/182f6dv/official_rrust_whos_hiring_thread_for_jobseekers/) can also work well.
Post jobs where Rust developers already look. Good starting points are [Filtra.io](https://filtra.io/rust), [RustJobs.dev](https://rustjobs.dev/), [RustJobs.fyi](https://www.rustjobs.fyi/), and [RemoteOK](https://remoteok.com/). The monthly "Who is hiring?" threads on [Hacker News](https://news.ycombinator.com/) and [Reddit](https://www.reddit.com/r/rust/comments/182f6dv/official_rrust_whos_hiring_thread_for_jobseekers/) can also work well.

## Assessing Candidates for Rust Roles

Expand Down
6 changes: 3 additions & 3 deletions content/blog/illegal-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ resources = [
"[Compile-Time Invariants](/blog/compile-time-invariants/) - Explore advanced techniques for encoding invariants in the type system",
]
reviews = [
{ name = "Wesley Moore", url = "https://www.wezm.net" },
{ name = "Wesley Moore", url = "https://www.wezm.net/v2/" },
{ name = "Nicolas Kosinski", url = "https://github.com/nicokosi" },
{ name = "zSchön", url = "https://mastodon.social/@TheAlgorythm@chaos.social" },
{ name = "mo8it", url = "https://mastodon.social/@mo8it@fosstodon.org" },
{ name = "zSchön", url = "https://chaos.social/@TheAlgorythm" },
{ name = "mo8it", url = "https://fosstodon.org/@mo8it" },
{ name = "Andreas Kröpelin", url = "https://www.andreaskroepelin.de" },
]
+++
Expand Down
6 changes: 3 additions & 3 deletions content/blog/immutability/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ and multiple moving parts.

> A large fraction of the flaws in software development are due to programmers
> not fully understanding all the possible states their code may execute in.
> &mdash; [John Carmack](http://www.sevangelatos.com/john-carmack-on/)
> &mdash; [John Carmack](https://www.sevangelatos.com/john-carmack-on/)

Immutability can help us reduce the cognitive load of keeping track of state.
Instead of having to keep track of all the ways in which a variable can change,
Expand All @@ -59,7 +59,7 @@ This brings us to Rust, a language that has chosen to prioritize immutability.

In Rust, variables are immutable by default, which means that once a
variable is bound to a value, it cannot be changed
(unless you [try excruciatingly hard to shoot yourself in the foot](https://stackoverflow.com/a/54242058/270334)).
(unless you [try excruciatingly hard to shoot yourself in the foot](https://stackoverflow.com/questions/54237610/is-there-a-way-to-make-an-immutable-reference-mutable/54242058#54242058)).

```rust
let x = 42;
Expand Down Expand Up @@ -403,7 +403,7 @@ On top of that, they are a common source of deadlocks.
Immutable code is easier to test, parallelize, and reason about. It's also
easier to refactor, because you don't have to worry about side effects.

Where [C/C++ requires you to explicitly declare things as immutable](https://stackoverflow.com/a/29682542/270334), Rust requires you to explicitly declare things as mutable, making everything else immutable by default.
Where [C/C++ requires you to explicitly declare things as immutable](https://stackoverflow.com/questions/28587698/whats-the-difference-between-placing-mut-before-a-variable-name-and-after-the/29682542#29682542), Rust requires you to explicitly declare things as mutable, making everything else immutable by default.

Rust pushes you towards immutability and offers `mut` as an opt-in escape hatch
for hot paths and tight loops. Many (perhaps most) other languages do the exact
Expand Down
4 changes: 2 additions & 2 deletions content/blog/local-reasoning-in-rust/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ The goal is to make your API easier to understand and harder to misuse.

{{ <next_steps context="Want a second pair of eyes on your Rust APIs? I can help you put these patterns to work in your codebase." source="local-reasoning-in-rust" /> }}

[^deref]: [RFC 241: Deref coercions](https://github.com/rust-lang/rfcs/blob/master/text/0241-deref-conversions.md) discusses why automatically borrowing arguments would make local reasoning harder.
[^deref]: [RFC 241: Deref coercions](https://github.com/rust-lang/rfcs/blob/main/text/0241-deref-conversions.md) discusses why automatically borrowing arguments would make local reasoning harder.

[^impl-trait]: [RFC 1951: Expand `impl Trait`](https://rust-lang.github.io/rfcs/1951-expand-impl-trait.html) explains ergonomics in terms of how much you have to keep in your head, and discusses who chooses the concrete type.

Expand All @@ -472,7 +472,7 @@ The goal is to make your API easier to understand and harder to misuse.
[^unsafe]: [RFC 2585: Unsafe blocks in unsafe functions](https://rust-lang.github.io/rfcs/2585-unsafe-block-in-unsafe-fn.html) separates defining safety obligations from satisfying them.
The [Rust 2024 edition guide](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html) covers the lint's current default.

[^errors]: [RFC 236: Error conventions](https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md) recommends expressing contracts through types where possible, and using `Result` or `Option` when a stricter contract is hard to justify.
[^errors]: [RFC 236: Error conventions](https://github.com/rust-lang/rfcs/blob/main/text/0236-error-conventions.md) recommends expressing contracts through types where possible, and using `Result` or `Option` when a stricter contract is hard to justify.
The discussion of task failure predates Rust 1.0; the advice about API contracts is the relevant part here.

[^non-exhaustive]: [RFC 2008: Non-exhaustive enums and structs](https://rust-lang.github.io/rfcs/2008-non-exhaustive.html) discusses exhaustive matching and the freedom to add new variants.
Loading
Loading