Stream: cranelift

Topic: Cranelift Docs Only Compiling for Host Arch?


view this post on Zulip Nihal Pasham (Oct 21 2024 at 08:58):

While browsing through the Cranelift documentation, I noticed that public docs are only available for the host architecture, specifically x64. I assume this is because crates.io publishes documentation for Wasmtime as a whole rather than for individual crates. When compiling the docs locally using cargo doc --open for Wasmtime, it generates host-specific documentation, whereas Cranelift produces docs for all architectures.

Is there a plan to switch to publishing individual crate documentation?

view this post on Zulip bjorn3 (Oct 21 2024 at 11:11):

I assume this is because crates.io publishes documentation for Wasmtime as a whole rather than for individual crates.

It is actually for the exact opposite reason. Docs on docs.rs are generated for each individual crate. Cranelift-codegen doesn't specify that the all-arch feature should be enabled when building docs on docs.rs. When doing a local doc build however, feature unification likely causes the all-arch enable at https://github.com/bytecodealliance/wasmtime/blob/6a5a4f272a1788617308c36a34eb6dc3442e2b24/cranelift/Cargo.toml#L53 to be picked up when documenting cranelift-codegen.

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Nihal Pasham (Oct 21 2024 at 11:29):

Does this mean that feature unification is not enabled when building on docs.rs? Would it make sense to customize docs.rs builds in this case?

view this post on Zulip bjorn3 (Oct 21 2024 at 13:07):

Docs.rs documents a crate at a time, while locally you generally document a whole workspace at once. Feature unification only applies when everything gets done in a single cargo invocation.

view this post on Zulip bjorn3 (Oct 21 2024 at 13:07):

Would it make sense to customize docs.rs builds in this case?

Yes

view this post on Zulip fitzgen (he/him) (Oct 21 2024 at 16:51):

we should do all features for docs.rs plus the nightly attribute to doc required features, the same way we do in wasmtime

view this post on Zulip fitzgen (he/him) (Oct 21 2024 at 16:52):

would love to approve + merge a PR doing this for cranelift, if you'd like to make one!

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.
A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Nihal Pasham (Oct 22 2024 at 07:53):

Sure, I’ve just submitted a PR for this: https://github.com/bytecodealliance/wasmtime/pull/9493

Summary Enabled --all-features for Cranelift documentation via: [package.metadata.docs.rs] all-features = true Added #![cfg_attr(docsrs, feature(doc_auto_cfg))] to display feature requirements in...

view this post on Zulip Nihal Pasham (Oct 30 2024 at 02:35):

Quick question – the PR was merged a week ago, but the docs (for cranelift-codegen) published on crates.io still don't seem to reflect the changes. Did I miss something?

view this post on Zulip Chris Fallin (Oct 30 2024 at 06:05):

crates.io contains only published crates (and docs.rs shows docs for published crates); there hasn't been a release since your PR was merged. Our release process is to cut a release branch on the 5th of the month, let it stabilize (watch for fuzzbugs), and release that branch on the 20th; so your PR should go out in our release on Nov 20th.

view this post on Zulip Nihal Pasham (Oct 30 2024 at 08:47):

Oh Ok. Thank you.


Last updated: Dec 23 2024 at 12:05 UTC