HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
bazelbuild
rules_rust
Starlark2016–2024
bazelbuild / rules_rust

rules_rust

Rust rules for Bazel

11Distinct people
12Mentions
0Explicit recommenders
856GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Rust rules for Bazel

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year12 dated mentions

Observed mentions: 2016-12-16 16:21:26 UTC to 2024-05-28 22:58:43 UTC.

01232016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202

What Hacker News says

12 sources
Rustc is very tightly coupled with cargo. Nothing stops you from calling rustc yourself, but you basically need to reverse engineer what cargo is doing. My reference for this is https://github.com/bazelbuild/rules_rust which needs to pass a bunch of CARGO_ envvars to get stuff to build, among various other required conventions.
In [dead]
The same reason Bazel builds avoid using Cargo when building Rust software, so I'll describe why Bazel would do this: - Bazel wants to cache remote resources, like each respective crate's source files. - Bazel then wants to build each crate in a sandbox, and cache the build artifacts. Because bazel owns this process, instead of Cargo, it can trivially distribute those build artifacts to other developers, or in CI, etc -- instead of everyone having to build everything from scratch. This is an established practice, and Nix wants to drive the build for the same reasons. See: - https://github.com/bazelbuild/rules_rust - https://github.com/google/cargo-raze
In NixOS: Declarative Builds and Deployments
Oh wow. I'd be very interested in hearing how they sandbox rust-analyzer. I found a discussion of supporting the analyzer itself by generating config files [1][2], but not how you can sandbox it. That would be extremely useful as the analyzer is a pretty juicy target and also runs proc-macros/build.rs scripts. [1] https://github.com/bazelbuild/rules_rust/pull/384 [2] https://bazelbuild.github.io/rules_rust/rust_analyzer.html
In Rust devs push back as Serde project ships precompiled binaries
I think the newer version of this is https://github.com/bazelbuild/rules_rust which lets you either vendor the dependencies or pull them from your Cargo.toml directly every time. Per the article: bazel + rules_rust should have the flexibility to override the linker flags that Cargo may take as required since that would be a property of the bazel toolchain used. It's a nice amalgamation of how cargo works and how bazel works. In general bazel supports hermetic builds, multiple toolchains, cross complilation, and ways to compile multi-language projects. I still wish that Cargo.toml didn't support build.rs as it can cause a lot of system-dependent problems that bazel sidesteps entirely by being hermetic.
In Rust is actually portable
Bazel is generally much more useful when it can manage the entire build. https://github.com/bazelbuild/rules_rust implements this logic for rust. It calls rustc directly, without cargo for the build, and interacts with cargo through a shim to fetch/vendor dependencies. Google uses various non-cargo build systems to build rust. I don't think Google is actually using bazel for this internally, eg. Fuchsia uses https://fuchsia.googlesource.com/fuchsia/+/master/third_part...
In Cargo-style dependency management for C, C++ and other languages with Meson

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.