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 +nightly doc panics for crates depending on gfx-backend-empty #70874

Closed
grovesNL opened this issue Apr 7, 2020 · 4 comments · Fixed by #71048
Closed

cargo +nightly doc panics for crates depending on gfx-backend-empty #70874

grovesNL opened this issue Apr 7, 2020 · 4 comments · Fixed by #71048
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@grovesNL
Copy link
Contributor

grovesNL commented Apr 7, 2020

If I create a new crate with

cargo new --lib rustdocissue

Then add a dependency on gfx-backend-empty version 0.5:

[dependencies]
gfx-backend-empty = "0.5"

Then run cargo doc on stable:

cargo +stable doc --lib --no-deps

cargo doc succeeds with warnings. I'm not sure if the warnings are relevant, but the warnings in cargo +stable doc are for some empty blocks in examples that haven't been populated, such as:

/// ```no_run
///
/// ```

Now if I run the same command on nightly (nightly-2020-04-06):

cargo +nightly doc --lib --no-deps

cargo doc panics with the following error:

thread 'rustc' panicked at 'could not find markdown in source', src/librustdoc/passes/mod.rs:411:31

The panic originates in

let source_line = src_lines.next().expect("could not find markdown in source");

Besides stable and nightly, I tried the nightly-2020-03-19 toolchain which succeeds with warnings (like stable).

I also created a repo which reproduces the issue at https://github.com/grovesNL/rustdocissue if it's convenient to clone that instead of following the steps above.

@grovesNL grovesNL added the C-bug Category: This is a bug. label Apr 7, 2020
@jonas-schievink jonas-schievink added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Apr 7, 2020
@jonas-schievink
Copy link
Contributor

cc @rust-lang/rustdoc

bors bot added a commit to gfx-rs/wgpu-rs that referenced this issue Apr 8, 2020
245: Check `cargo doc` in CI r=kvark a=hecrj

This PR makes CI run `cargo doc` using the latest nightly.

It is currently panicking here:

https://github.com/rust-lang/rust/blob/6dee5f1126dfd5c9314ee5ae9d9eb010e35ef257/src/librustdoc/passes/mod.rs#L411

I thought it was an incorrect link causing it, but the issue seems to persist even after fixing the link.

__Update__: Issue opened upstream by @grovesNL (rust-lang/rust#70874).

Co-authored-by: Héctor Ramón Jiménez <hector0193@gmail.com>
bors bot added a commit to gfx-rs/wgpu-rs that referenced this issue Apr 9, 2020
245: Check `cargo doc` in CI r=kvark a=hecrj

This PR makes CI run `cargo doc` using the latest nightly.

It is currently panicking here:

https://github.com/rust-lang/rust/blob/6dee5f1126dfd5c9314ee5ae9d9eb010e35ef257/src/librustdoc/passes/mod.rs#L411

I thought it was an incorrect link causing it, but the issue seems to persist even after fixing the link.

__Update__: Issue opened upstream by @grovesNL (rust-lang/rust#70874).

Co-authored-by: Héctor Ramón Jiménez <hector0193@gmail.com>
@GuillaumeGomez
Copy link
Member

Oh that's bad. We should make a warning about empty code blocks though. I'll send a PR shortly.

@eddyb
Copy link
Member

eddyb commented Apr 10, 2020

cc @arlosi - we're discussing this on Discord and @GuillaumeGomez has bisected it to #69718.

@arlosi
Copy link
Contributor

arlosi commented Apr 12, 2020

It seems that before #69718, the hash would not have matched, so the external source would be "not present". After #69718, the external source would be present, but not-normalized. Which I suspect would cause any offsets into it to be incorrect.

I'm not exactly sure how it worked before (given that it would have absent external source).

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 12, 2020
Normalize source when loading external foreign source into SourceMap

The compiler normalizes source when reading files initially (removes BOMs, etc), but not when loading external sources.

This leads to the external source matching according to the `src_hash`, but differing internally because it was not normalized.

Fixes rust-lang#70874.
@bors bors closed this as completed in f41aa16 Apr 12, 2020
kvark pushed a commit to kvark/wgpu that referenced this issue Jun 3, 2021
245: Check `cargo doc` in CI r=kvark a=hecrj

This PR makes CI run `cargo doc` using the latest nightly.

It is currently panicking here:

https://github.com/rust-lang/rust/blob/6dee5f1126dfd5c9314ee5ae9d9eb010e35ef257/src/librustdoc/passes/mod.rs#L411

I thought it was an incorrect link causing it, but the issue seems to persist even after fixing the link.

__Update__: Issue opened upstream by @grovesNL (rust-lang/rust#70874).

Co-authored-by: Héctor Ramón Jiménez <hector0193@gmail.com>
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. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

5 participants