google/zerocopy

[ci] Cargo doc step `jq` error

joshlf opened this issue · 1 comments

In CI, this error has been happening, but not blocking merges thanks to a lack of set -e:

jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.packages[] | select(.name == "zerocopy").metadata.docs.rs."rustdoc-args".[]                                                                          
jq: 1 compile error

Hi @joshlf,

I've made progress on the issue at hand and managed to correct the jq command that extracts the rustdoc-args from Cargo.toml. Unfortunately, this fix has uncovered a series of subsequent errors.

Initially, the CI failed on the Cargo doc job due to the generate-link-to-definition flag in rustdoc. This issue had not previously arisen because the rustdoc-args were not being correctly passed, hence the job had never failed.

To address this, I've moved the generate-link-to-definition flag to RUSTDOCFLAGS and included a conditional check for the nightly toolchain. After that, there is issue related to the use of #![feature] as indicated by the following error:

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> src/lib.rs:271:22
    |
271 | #![cfg_attr(doc_cfg, feature(doc_cfg))]
    |                     

Hence I move the --cfg doc_cfg from rustdoc-args to RUSTDOCFLAGS, since feature() is exclusive to the nightly toolchain.

Given these developments, it appears we no longer require flag extraction from the metadata since we've eliminated all features specific to Cargo.toml. Nevertheless, I have preserved the flag querying logic for potential future use with stable flags.

Best regards,
Matt