Skip to content
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

Rename docs_rs config condition to docsrs #956

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

dannycjones
Copy link
Contributor

Description of change

This change is made to avoid config condition errors now that check config is run by default in Rust 1.80+.

Without this change, compilation will fail like below:

error: unexpected `cfg` condition name: `docs_rs`
    --> mountpoint-s3-client/src/s3_crt_client.rs:1162:16
     |
1162 | #[cfg_attr(not(docs_rs), async_trait)]
     |                ^^^^^^^ help: there is a config with a similar name: `docsrs`
     |
     = help: consider using a Cargo feature instead
     = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
              [lints.rust]
              unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docs_rs)'] }
     = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(docs_rs)");` to the top of the `build.rs`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

Rather than specifying the docs_rs config condition in our Cargo.toml, we can use the one already existing and documented by docs.rs: https://docs.rs/about/builds#detecting-docsrs

To recognize Docs.rs from your Rust code, you can test for the docsrs cfg, e.g.:

#[cfg(docsrs)]
mod documentation;

This change removes the setting of docs_rs cfg condition and updates all conditions to use the existing condition set by docs.rs.

Checked using the following command that the docs aren't a mess by looking at mountpoint_s3_client::object_client::PutObjectRequest:

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

Fixes CI issue blocking PR #949.

Relevant issues: N/A

Does this change impact existing behavior?

No.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).

This change is made to avoid config condition errors now that check config is run by default in Rust 1.80+.

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
@dannycjones dannycjones added this pull request to the merge queue Jul 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 29, 2024
@dannycjones dannycjones added this pull request to the merge queue Jul 29, 2024
Merged via the queue into awslabs:main with commit b4e11b8 Jul 29, 2024
23 checks passed
@dannycjones dannycjones deleted the fix-clippy-ci branch July 29, 2024 16:16
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