Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs.rs build with cfg(docsrs) #3561

Merged
merged 1 commit into from
Feb 27, 2021
Merged

Fix docs.rs build with cfg(docsrs) #3561

merged 1 commit into from
Feb 27, 2021

Conversation

pka
Copy link
Contributor

@pka pka commented Feb 27, 2021

Motivation

For crates which set rustc-args = ["--cfg", "docsrs"] in [package.metadata.docs.rs], tokio-stream fails to build on docs.rs with

[INFO] [stderr]    Compiling tokio-stream v0.1.3
[INFO] [stderr] error[E0636]: the feature `doc_cfg` has already been declared
[INFO] [stderr]   --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/tokio-stream-0.1.3/src/lib.rs:24:29
[INFO] [stderr]    |
[INFO] [stderr] 24 | #![cfg_attr(docsrs, feature(doc_cfg))]
[INFO] [stderr]    |                             ^^^^^^^

Solution

Remove duplicate cfg_attr line

The first occurence is on https://github.com/tokio-rs/tokio/blob/master/tokio-stream/src/lib.rs#L17

For crates which set `rustc-args = ["--cfg", "docsrs"] ` in `[package.metadata.docs.rs]`, tokio-stream fails to build on docs.rs with

```
[INFO] [stderr]    Compiling tokio-stream v0.1.3
[INFO] [stderr] error[E0636]: the feature `doc_cfg` has already been declared
[INFO] [stderr]   --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/tokio-stream-0.1.3/src/lib.rs:24:29
[INFO] [stderr]    |
[INFO] [stderr] 24 | #![cfg_attr(docsrs, feature(doc_cfg))]
[INFO] [stderr]    |                             ^^^^^^^
```

The first occurence of the same `cfg_attr` command is on https://github.com/tokio-rs/tokio/blob/master/tokio-stream/src/lib.rs#L17
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Darksonn Darksonn added the A-tokio-stream Area: The tokio-stream crate label Feb 27, 2021
@Darksonn
Copy link
Contributor

Do we not test with this flag in CI?

@Darksonn Darksonn merged commit fd93ecf into tokio-rs:master Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-stream Area: The tokio-stream crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants