NVTX crate fails to compile with rustdoc with `--cfg docsrs`

Open Beginner friendly
#195 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
documentation

Research direction

The failing attribute is at rust/src/lib.rs line 5, where the docsrs cfg enables feature(doc_auto_cfg, doc_cfg). Reproduce first by running RUSTDOCFLAGS="--cfg docsrs" cargo doc inside the rust/ directory, then apply the replacement shown in the issue: enable only doc_cfg as a feature and move auto_cfg into a separate doc(auto_cfg) attribute. Done when that cargo doc command builds the nvtx crate without the E0557 error.

Written by the indexing model from the issue text.

Description

E.g. when running

export RUSTDOCFLAGS="--cfg docsrs"
cargo doc

I get

  |
5 | #![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
  |                             ^^^^^^^^^^^^ feature has been removed
  |
  = note: removed in 1.92.0; see <https://github.com/rust-lang/rust/pull/138907> for more information
  = note: merged into `doc_cfg`

error: Compilation failed, aborting rustdoc

For more information about this error, try `rustc --explain E0557`.
error: could not document `nvtx`

It seems that the equivalent of

https://github.com/NVIDIA/NVTX/blob/aeda87dd3a913acce29407b6555ddebff98a9e53/rust/src/lib.rs#L5

seems to be now

#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, doc(auto_cfg))]

See https://github.com/rust-lang/rust/pull/138907/changes

Dominant language
C++
Stars
573
Forks
87
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/NVTX

All issues in NVIDIA/NVTX

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.