Skip to content

ICE when running rustdoc in JSON mode on clap #97432

Closed
@zdimension

Description

@zdimension

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions