Skip to content

Conversation

@itowlson
Copy link
Contributor

This moves some docs to link correctly in re-exports from the spin-sdk crate, and tweaks others to deal with rustdoc's tendency to do nasty merges on re-export docstrings. Also:

  • Added some notes around stability and opt-ins
  • Fixed an error message (which I felt was sufficiently in the spirit of docs, if not the letter, to save me opening a separate 10-character PR)

@itowlson itowlson marked this pull request as draft October 27, 2025 23:55
Signed-off-by: itowlson <[email protected]>
@itowlson
Copy link
Contributor Author

The bonus shenanigans are to enable a feature tag on docs.rs.

image

For REASONS relating to NIGHTLIES and UNSTABLES and DEPENDENCIES and WEARISOME TOIL this requires a special incantation to test which is:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --open --no-deps

and even then we are relying on Some Bloke On Stack Overflow's assurance that docs.rs will call us this way (for, admittedly, large values of Some Bloke On Stack Overflow).

Anyway that is what the weird cfg incantations are about, I can remove them if they give people the collywobbles, I am going to have a cup of tea

@itowlson itowlson marked this pull request as ready for review October 28, 2025 00:14
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I'd like to see if we can change where the doc lives.

/// The macro expands into a module containing a `Spin` struct that implements the
/// WASI `http.handler/Guest` interface, wiring the annotated function as the
/// handler’s entrypoint. This allows the function to be invoked automatically
/// by the Spin runtime when HTTP requests are received.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can achieve the same thing with moving these docs back to the definition site and then using #[doc(inline)]? If that works, that might be preferable to have the docs next to the definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that would be tidier. But the docs contain links to Spin SDK types, and when the docs are in the WASIp3 macro crate those links fail to resolve (warnings and/or errors during cargo doc). But maybe there's a handy way around that? (Or maybe docs.rs does the right thing anyway, and we just need to address the local case?) If so, let's catch up when you're around with a view to doing it in a follow-up PR.

@itowlson itowlson merged commit 32f31aa into spinframework:main Oct 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants