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

Rustdoc allows multiple declarations of a feature #82588

Closed
Nemo157 opened this issue Feb 27, 2021 · 1 comment · Fixed by #82598
Closed

Rustdoc allows multiple declarations of a feature #82588

Nemo157 opened this issue Feb 27, 2021 · 1 comment · Fixed by #82598
Assignees
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Feb 27, 2021

I tried this code:

#![feature(doc_cfg)]
#![feature(doc_cfg)]

fn main() {
    println!("Hello, world!");
}

I expected to see this happen: Both cargo build and cargo doc to fail because of multiple declarations of the doc_cfg feature.

Instead, this happened: cargo build failed while cargo doc succeeded:

> cargo build
   Compiling foo v0.1.0 (/tmp/tmp.NidTpZ70xE/foo)
error[E0636]: the feature `doc_cfg` has already been declared
 --> src/main.rs:2:12
  |
2 | #![feature(doc_cfg)]
  |            ^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0636`.
error: could not compile `foo`

To learn more, run the command again with --verbose.

> cargo doc
 Documenting foo v0.1.0 (/tmp/tmp.NidTpZ70xE/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 0.48s

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (07194ffcd 2021-02-10)
binary: rustc
commit-hash: 07194ffcd25b0871ce560b9f702e52db27ac9f77
commit-date: 2021-02-10
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
@Nemo157 Nemo157 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. labels Feb 27, 2021
@GuillaumeGomez
Copy link
Member

Indeed, adding a fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants