Skip to content

Enabling "glob" feature makes compilation fail on stable #70

Description

@aldanor
error[E0658]: `#[doc(cfg)]` is experimental
   --> .../include_dir-0.7.1/src/lib.rs:102:1
    |
102 | #[doc(cfg(feature = "glob"))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I don't think you need it at all because since recently #[cfg] implies #[doc(cfg)] (rust-lang/rust#89596).

Also, in some very rare cases when it may not work and you need to do it manually, you can do this:

  • In Cargo.toml:
    [package.metadata.docs.rs]
    features = ["foo", "bar"]
    rustdoc-args = ["--cfg", "docsrs"]
  • In lib.rs:
    #![cfg_attr(docsrs, feature(doc_cfg))]
  • And then you can safely do:
    #[cfg_attr(docrs, doc(cfg(feature = "foo")))]
  • And in order to build docs locally:
    RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features foo,bar

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions