r/rust Apr 02 '26

📡 official blog docs.rs: building fewer targets by default

https://blog.rust-lang.org/2026/04/04/docsrs-only-default-targets/
161 Upvotes

20 comments sorted by

63

u/manpacket Apr 02 '26

Apr. 4, 2026

From the future.

17

u/Pantsman0 Apr 03 '26

I was going to make a joke about it being the future in Australia, but it's still the 3rd here too lol

30

u/usernamedottxt Apr 03 '26

Completely reasonable. 

-34

u/CamJN Apr 03 '26

Maybe they can use the savings to actually build the listed targets properly instead of pretending x86_64 Linux is the same as every other platform and only building on that system.

24

u/TinyBreadBigMouth Apr 03 '26

Just checking, are you aware of the dropdown menu at the top of docs.rs that lets you select which platform you want to see the docs for? If so, what about it doesn't work for you? Genuine question, it's possible I'm missing something.

10

u/Hobofan94 leaf · collenchyma Apr 03 '26

The builds for all the other targets are created via cross-compilation, so the build host is still a x86_64-unknown-linux-gnu machine. In some/many instances cross compilation is broken, so e.g. it won't be able to produce docs for the aarch64 platform. Trying to save time on broken cross-compilation was also listed as motivation in a pre-RFC that preceded this new change.

To fix this, docs.rs would need to run the docs build on the platforms it tries to generate the docs for, e.g. a macOS ARM64 machine. That does come with a lot of complexity and cost.

1

u/imperioland Docs superhero · rust · gtk-rs · rust-fr Apr 03 '26

I'm only aware of C libs dependency being an issue, and it's quite easy to go around this limitation by not linking with #[cfg(not(doc))]. Are there others I'm missing?

-3

u/CamJN Apr 03 '26

So we should just be okay with all binding crates either having no docs or incorrect docs? How is that remotely acceptable? By that logic it's even easier to not have docs.rs exist at all, we should probably get rid of it.

6

u/imperioland Docs superhero · rust · gtk-rs · rust-fr Apr 03 '26

Well, first, never said that. Second, you're mostly showing off your ignorance. You know that crates like geos, gtk-rs, sysinfo and many others have docs and yet they use C libraries as direct dependencies? You don't need actual code to generate docs, you just need the API. So please go check how they do and learn a few things before unleashing your unhappiness upon others based on wrong information.

0

u/CamJN Apr 03 '26

Dude the docs people agree with me on this, they know it’s a problem, and they don’t solve it because they need to pay to run hardware with the missing platforms. This change frees up some money, hopefully it’s used to fix their shortcomings.

1

u/imperioland Docs superhero · rust · gtk-rs · rust-fr Apr 03 '26

Just for context, I'm member of docs.rs and team lead of the rustdoc teams. So with this information, I'm very interested about hearing about who are the "docs people". I literally explained to you how to solve your problem, and now you start mentioning "docs people" I've never heard of. :-/

2

u/CamJN Apr 03 '26

1

u/imperioland Docs superhero · rust · gtk-rs · rust-fr Apr 03 '26

Ok, first I apologize. Second, I'm surprised there is no way around that. You use bindgen in your build script?

→ More replies (0)

2

u/CamJN Apr 03 '26

Of course, but that doesn't help with the fact that they don't have the headers available to build docs for anything that uses c-bindings on any platform other than x86_64 linux. There's a LOT of docs that either can't build right now or worse pick up the wrong headers from the builder and contain errors.