Skip to content

Replace doc(include) due to feature removal #2618

@rami3l

Description

@rami3l

Please complete the following tasks

  • I have searched the discussions
  • I have searched the existing issues

Clap Version

master

Where?

./src/lib.rs

What's wrong?

rust-lang/rust#85457 indicates that doc(include) has been removed, and thus the following lines in our current codebase needs to be replaced:

clap/src/lib.rs

Lines 6 to 9 in 8ff6808

#![cfg_attr(feature = "doc", feature(external_doc))]
#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")]
#![doc(html_root_url = "https://docs.rs/clap/3.0.0-beta.2")]
#![cfg_attr(feature = "doc", doc(include = "../README.md"))]

This will give the following error on Rust 1.54.0+ (see also: elastic/elasticsearch-rs#175):

feature has been removed
use #[doc = include_str!("filename")] instead, which handles macro invocations

How to fix?

The previous lines should be changed to the following to work on Rust version 1.55.0-nightly:

#![doc(html_logo_url = "https://clap.rs/images/media/clap.png")] 
#![doc(html_root_url = "https://docs.rs/clap/3.0.0-beta.2")] 
#![cfg_attr(feature = "doc", doc = include_str!("../README.md"))]

Also, the final line of README.md:

clap/README.md

Line 588 in 8ff6808

[examples]: examples

should also be replaced by an absolute address to work well with docs.rs.

I have not made a PR yet due to compatibility concerns, since AFAIK the fix will only work on Rust 1.54.0+. Introducing something like dtolnay/rustversion is completely possible, but I have to be very careful with the dependencies of clap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: documentation, including docs.rs, readme, examples, etc...

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions