`#![feature(doc_cfg)]` uses feature name from dependency, not the feature that enables the method
@GuillaumeGomez is already working on this.
Since Jun 6, 2026.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
https://github.com/jhpratt/doc-cfg-demo
Reproduction Steps
after cloning the repository
cd alpha
cargo +nightly doc --all-features
Outcome
The documentation for S::foo shows Available on crate feature `wrong-feature-name` only. It should show Available on crate feature `correct-feature-name` only. While correct for crate beta, a user viewing the docs of crate alpha does not care about that; they would want to see what feature of alpha is needed to enable the method in question.
Version
rustc 1.98.0-nightly (57d06900f 2026-05-27)
This bug has existed for years; I'd be very surprised if it was fixed since I last updated my nightly version.
Additional Details
Feel free to use the repository in any manner you'd like, including as a regression test.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.