News for hackers. Stuff that matters.
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by pxc on Monday January 05, 2026 @07:33PM (#46507246)
Edit: I misremembered a Rust crates capability (pre- and post-install hooks), so my comment was useless and misleading.
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by TheDong on Monday January 05, 2026 @07:55PM (#46507409)
Rust crates run arbitrary code more often at build/install time than npm packages do.

Some people use 'pnpm', which only runs installScripts for a whitelisted subset of packages, so an appreciable fraction of the npm ecosystem (those that don't use npm or yarn, but pnpm) do not run scripts by default.

Cargo compiles and runs `build.rs` for all dependencies, and there's no real alternative which doesn't.

Re:Brave overhauled its Rust adblock engine with FlatBuffers... by steveklabnik on Monday January 05, 2026 @07:49PM (#46507350)
Rust crates can run arbitrary code at build time: https://doc.rust-lang.org/cargo/reference/build-scripts.html
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by pxc on Monday January 05, 2026 @08:01PM (#46507456)
Geez, thank you.
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by rafram on Tuesday January 06, 2026 @10:56AM (#46513929)
> Build scripts communicate with Cargo by printing to stdout.

Oh lord.

Re:Brave overhauled its Rust adblock engine with FlatBuffers... by ComputerGuru on Tuesday January 06, 2026 @01:28PM (#46516407)
Wrote an entire crate to clean up that mess (and provide traditional autoconf-ish features for build.rs): https://crates.io/crates/rsconf
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by nasso_dev on Monday January 05, 2026 @07:53PM (#46507391)
Aren't procedural macros amd build.rs arbitrary code being executed at build time?
Re:Brave overhauled its Rust adblock engine with FlatBuffers... by tuetuopay on Tuesday January 06, 2026 @04:56AM (#46510525)
Pretty much, yes. And they don’t have much as far as isolation goes. It’s a bit frightening honestly.

It does unlock some interesting things to be sure, like sqlx’ macros that check the query at compile time by connecting to the database and checking the query against it. If this sounds like the compiler connecting to a database, well, it’s because it is.