Skip to content

feat(ci): build and check rustdocs for warnings; fix(docs): add missing cfg flag to allow displaying features on doc.rs, fix various warnings #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2025

Conversation

jlizen
Copy link
Contributor

@jlizen jlizen commented May 27, 2025

📬 Issue #, if available:
n/a

✍️ Description of changes:
Fix for: https://docs.rs/crate/lambda_runtime/0.14.0/builds/2162130

[INFO] [stderr]  Documenting lambda_runtime v0.14.0 (/opt/rustwide/workdir)
[INFO] [stderr] error[E0658]: `#[doc(cfg)]` is experimental
[INFO] [stderr]   --> src/lib.rs:35:20
[INFO] [stderr]    |
[INFO] [stderr] 35 | #[cfg_attr(docsrs, doc(cfg(feature = "tracing")))]
[INFO] [stderr]    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr]    |
[INFO] [stderr]    = note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
[INFO] [stderr]    = help: add `#![feature(doc_cfg)]` to the crate attributes to enable
[INFO] [stderr]    = note: this compiler was built on 2025-05-26; consider upgrading it if it is out of date
[INFO] [stderr] 
[INFO] [stderr] For more information about this error, try `rustc --explain E0658`.
[INFO] [stderr] error: could not document `lambda_runtime`

We want to display the feature gates on items in docs.rs. However, we were missing the crate-level #![cfg_attr(docsrs, feature(doc_cfg))] necessary to do so.

This made it through our CI since we don't build/validate docs. Adding that in.

I structured it as a standalone step since docs.rs target only builds on the nightly branch. I just tossed all the crates into it rather than segmenting - there are cross-crate doc linking interdependencies, and anyway it's a quick step.

This required fixing a TON of docs warnings since I have the step configured to fail on warnings (broken doc links, etc).

Testing

It's passing on my branch's CI: https://github.com/jlizen/aws-lambda-rust-runtime/actions/runs/15281293634/job/42980737800

Also the regular builds are still passing.

🔏 By submitting this pull request

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

shell: bash
env:
RUSTFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
Copy link
Contributor Author

@jlizen jlizen May 27, 2025

Choose a reason for hiding this comment

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

Dwarnings results in failing on warnings

Copy link
Contributor

@bnusunny bnusunny left a comment

Choose a reason for hiding this comment

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

LGTM

@bnusunny bnusunny merged commit 5d3e916 into awslabs:main May 28, 2025
13 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.

2 participants