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

ICE when running rustdoc in JSON mode on clap #97432

Closed
zdimension opened this issue May 26, 2022 · 2 comments · Fixed by #97599
Closed

ICE when running rustdoc in JSON mode on clap #97432

zdimension opened this issue May 26, 2022 · 2 comments · Fixed by #97599
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@zdimension
Copy link

zdimension commented May 26, 2022

Code

https://github.com/clap-rs/clap.git @ f2f9aa12

Error is obtained by running cargo +nightly rustdoc --lib -- -Zunstable-options -wjson

Removing -wjson prevents the error

This may be similar to #89097 or #83718 though both have been resolved and closed, but the issue here is still present on the latest nightly.

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (4c5f6e627 2022-05-17)
binary: rustc
commit-hash: 4c5f6e6277b89e47d73a192078697f7a5f3dc0ac
commit-date: 2022-05-17
host: x86_64-pc-windows-msvc
release: 1.63.0-nightly
LLVM version: 14.0.4

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Item { id: Id("0:146"), crate_id: 0, name: Some("CommandFactory"), span: Some(Span { filename: "src\\derive.rs", begin: (233, 0), end: (257, 1) }), visibility: Public, docs: Some("Create a [`Command`] relevant for a user-defined container.\n\nDerived as part of [`Parser`]."), links: {"`Command`": Id("0:725"), "`Parser`": Id("0:120")}, attrs: [], deprecation: None, inner: Trait(Trait { is_auto: false, is_unsafe: false, items: [Id("0:147"), Id("0:149"), Id("0:151"), Id("0:153")], generics: Generics { params: [], where_predicates: [] }, bounds: [TraitBound { trait_: ResolvedPath { name: "Sized", id: Id("2:3155"), args: Some(AngleBracketed { args: [], bindings: [] }), param_names: [] }, generic_params: [], modifier: None }], implementations: [Id("0:185")] }) }`,
 right: `Item { id: Id("0:146"), crate_id: 0, name: Some("IntoApp"), span: Some(Span { filename: "src\\derive.rs", begin: (233, 0), end: (257, 1) }), visibility: Public, docs: Some("Create a [`Command`] relevant for a user-defined container.\n\nDerived as part of [`Parser`]."), links: {"`Command`": Id("0:725"), "`Parser`": Id("0:120")}, attrs: [], deprecation: None, inner: Trait(Trait { is_auto: false, is_unsafe: false, items: [Id("0:147"), Id("0:149"), Id("0:151"), Id("0:153")], generics: Generics { params: [], where_predicates: [] }, bounds: [TraitBound { trait_: ResolvedPath { name: "Sized", id: Id("2:3155"), args: Some(AngleBracketed { args: [], bindings: [] }), param_names: [] }, generic_params: [], modifier: None }], implementations: [Id("0:185")] }) }`', src\librustdoc\json\mod.rs:196:17
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.63.0-nightly (4c5f6e627 2022-05-17) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -Z unstable-options

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `clap` (lib doc) generated 5 warnings
error: could not document `clap`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name clap src\lib.rs -o D:\Documents\GitHub\clap\target\doc --cfg "feature=\"atty\"" --cfg "feature=\"color\"" --cfg "feature=\"default\"" --cfg "feature=\"std\"" --cfg "feature=\"strsim\"" --cfg "feature=\"suggestions\"" --cfg "feature=\"termcolor\"" --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -Zunstable-options -wjson -C metadata=b7f8577a1e130165 -L dependency=D:\Documents\GitHub\clap\target\debug\deps --extern atty=D:\Documents\GitHub\clap\target\debug\deps\libatty-8763dbb3976b6bfd.rmeta --extern bitflags=D:\Documents\GitHub\clap\target\debug\deps\libbitflags-2782c434d426d8e6.rmeta --extern clap_lex=D:\Documents\GitHub\clap\target\debug\deps\libclap_lex-543d63249a2e68dc.rmeta --extern indexmap=D:\Documents\GitHub\clap\target\debug\deps\libindexmap-4816a6493dcda0e0.rmeta --extern strsim=D:\Documents\GitHub\clap\target\debug\deps\libstrsim-24d6778eabe8075a.rmeta --extern termcolor=D:\Documents\GitHub\clap\target\debug\deps\libtermcolor-67cffd7e3105544d.rmeta --extern textwrap=D:\Documents\GitHub\clap\target\debug\deps\libtextwrap-46a5161466f210c3.rmeta --crate-version 3.1.18` (exit code: 101)
@zdimension zdimension added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 26, 2022
@matthiaskrgr matthiaskrgr added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 26, 2022
@GuillaumeGomez
Copy link
Member

Code to reproduce the error:

pub use foo::Trait;
pub use foo::Trait as Reexport;

mod foo {
    pub trait Trait {}
}

@Enselic
Copy link
Member

Enselic commented Jun 1, 2022

@rustbot label +A-rustdoc-json

@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label Jun 1, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 2, 2022
…ftSpider

Fix JSON reexport ICE

Fixes rust-lang#97432.

The problem was that the ID was conflicting because the reexports have the same one. To fix it, I "extended" it by adding the `Symbol` into it as well.

r? `@notriddle`
@bors bors closed this as completed in f22f743 Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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