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

cargo doc emits errors, but then works anyway #285

Closed
bstrie opened this issue Jul 1, 2022 · 0 comments · Fixed by #286
Closed

cargo doc emits errors, but then works anyway #285

bstrie opened this issue Jul 1, 2022 · 0 comments · Fixed by #286

Comments

@bstrie
Copy link

bstrie commented Jul 1, 2022

$ cargo doc --open
   Compiling semver v1.0.11 (/home/ben/semver)
 Documenting semver v1.0.11 (/home/ben/semver)
error[E0308]: mismatched types
   --> src/lib.rs:525:29
    |
525 |     pub const EMPTY: Self = "";
    |                             ^^ expected struct `BuildMetadata`, found `&str`

error[E0308]: mismatched types
   --> src/lib.rs:502:29
    |
502 |     pub const EMPTY: Self = "";
    |                             ^^ expected struct `Prerelease`, found `&str`

For more information about this error, try `rustc --explain E0308`.
    Finished dev [unoptimized + debuginfo] target(s) in 0.81s
     Opening /home/ben/semver/target/doc/semver/index.html

I see that the lines in question have #[cfg(doc)] in order to work around rust-lang/rust#97933 , and it's true that this doesn't actually prevent the cargo doc from succeeding (somehow???), but it's a bit alarming at first, especially when semver is somewhere deep in your dependency tree and you wonder what horrible thing could have gone wrong that your project seems to cargo build properly but not cargo doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant