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 JSON ICE with #[doc(hidden)] on enum tuple field #100529

Closed
Enselic opened this issue Aug 14, 2022 · 4 comments · Fixed by #100582
Closed

rustdoc JSON ICE with #[doc(hidden)] on enum tuple field #100529

Enselic opened this issue Aug 14, 2022 · 4 comments · Fixed by #100582
Labels
A-rustdoc-json Area: Rustdoc JSON backend I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@Enselic
Copy link
Member

Enselic commented Aug 14, 2022

Found via #99919 (comment)

Step-by-step:

  1. Download and extract https://github.com/malobre/rust-vue-sfc/archive/refs/tags/v0.3.2.zip
  2. cd into the root dir and run cargo +nightly rustdoc --lib -- -Z unstable-options --output-format json with rustdoc 1.65.0-nightly (75b7e52e9 2022-08-13)

Expected

rustdoc JSON is built

Actual

/home/martin/Downloads/rust-vue-sfc-0.3.2
% cargo +nightly rustdoc --lib -- -Z unstable-options --output-format json
 Documenting vue-sfc v0.3.2 (/home/martin/Downloads/rust-vue-sfc-0.3.2)
thread 'rustc' panicked at 'internal error: entered unreachable code', src/librustdoc/json/conversions.rs:675:29
stack backtrace:
   0:     0x7f3732a1f1f0 - std::backtrace_rs::backtrace::libunwind::trace::h0ad3ea1f295943fa
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f3732a1f1f0 - std::backtrace_rs::backtrace::trace_unsynchronized::h3d735ea737b7cb6f
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3732a1f1f0 - std::sys_common::backtrace::_print_fmt::hfbffa4aad48cf418
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3732a1f1f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha738a84a6d451bf0
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3732a7a2be - core::fmt::write::h8417ef24f00d0b21
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f3732a0ff05 - std::io::Write::write_fmt::h3e7ec06f2b377bbe
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/io/mod.rs:1672:15
   6:     0x7f3732a21eb3 - std::sys_common::backtrace::_print::h7befeffc780b8cec
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3732a21eb3 - std::sys_common::backtrace::print::haf96690800a3a335
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3732a21eb3 - std::panicking::default_hook::{{closure}}::h1ac2b0dba5bc8279
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/panicking.rs:295:22
   9:     0x7f3732a21b9f - std::panicking::default_hook::h7348babc6f3f8e11
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/panicking.rs:314:9
  10:     0x7f3735260184 - <rustc_driver[8e6a5299f9cc0d8]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[104d4c2fa3822a9e]::ops::function::FnOnce<(&core[104d4c2fa3822a9e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f3732a226ed - std::panicking::rust_panic_with_hook::hc4945fbcea3150e8
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/panicking.rs:702:17
  12:     0x7f3732a22501 - std::panicking::begin_panic_handler::{{closure}}::h585f395f8e9063ac
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/panicking.rs:586:13
  13:     0x7f3732a1f6fc - std::sys_common::backtrace::__rust_end_short_backtrace::hf45c20ce028cb9f2
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f3732a22262 - rust_begin_unwind
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/panicking.rs:584:5
  15:     0x7f3732a76dd3 - core::panicking::panic_fmt::hba397905ae8201a3
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/core/src/panicking.rs:142:14
  16:     0x7f3732a76c1d - core::panicking::panic::h1050c7a91854cd90
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/core/src/panicking.rs:48:5
  17:     0x55f3f9db7dd7 - <rustdoc_json_types[6fb1e2c5ce75c474]::Variant as rustdoc[da35cc98693c420e]::json::conversions::FromWithTcx<rustdoc[da35cc98693c420e]::clean::types::Variant>>::from_tcx::{closure#0}
  18:     0x55f3f9d86418 - <core[104d4c2fa3822a9e]::iter::adapters::map::Map<alloc[857b60bb6b1cd1fc]::vec::into_iter::IntoIter<rustdoc[da35cc98693c420e]::clean::types::Item>, <rustdoc_json_types[6fb1e2c5ce75c474]::Variant as rustdoc[da35cc98693c420e]::json::conversions::FromWithTcx<rustdoc[da35cc98693c420e]::clean::types::Variant>>::from_tcx::{closure#0}> as core[104d4c2fa3822a9e]::iter::traits::iterator::Iterator>::fold::<(), core[104d4c2fa3822a9e]::iter::traits::iterator::Iterator::for_each::call<rustdoc_json_types[6fb1e2c5ce75c474]::Type, <alloc[857b60bb6b1cd1fc]::vec::Vec<rustdoc_json_types[6fb1e2c5ce75c474]::Type> as alloc[857b60bb6b1cd1fc]::vec::spec_extend::SpecExtend<rustdoc_json_types[6fb1e2c5ce75c474]::Type, core[104d4c2fa3822a9e]::iter::adapters::map::Map<alloc[857b60bb6b1cd1fc]::vec::into_iter::IntoIter<rustdoc[da35cc98693c420e]::clean::types::Item>, <rustdoc_json_types[6fb1e2c5ce75c474]::Variant as rustdoc[da35cc98693c420e]::json::conversions::FromWithTcx<rustdoc[da35cc98693c420e]::clean::types::Variant>>::from_tcx::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
  19:     0x55f3f9c8fae1 - <alloc[857b60bb6b1cd1fc]::vec::Vec<rustdoc_json_types[6fb1e2c5ce75c474]::Type> as alloc[857b60bb6b1cd1fc]::vec::spec_from_iter::SpecFromIter<rustdoc_json_types[6fb1e2c5ce75c474]::Type, core[104d4c2fa3822a9e]::iter::adapters::map::Map<alloc[857b60bb6b1cd1fc]::vec::into_iter::IntoIter<rustdoc[da35cc98693c420e]::clean::types::Item>, <rustdoc_json_types[6fb1e2c5ce75c474]::Variant as rustdoc[da35cc98693c420e]::json::conversions::FromWithTcx<rustdoc[da35cc98693c420e]::clean::types::Variant>>::from_tcx::{closure#0}>>>::from_iter
  20:     0x55f3f9db46df - rustdoc[da35cc98693c420e]::json::conversions::from_clean_item
  21:     0x55f3f9c272ab - <rustdoc[da35cc98693c420e]::json::JsonRenderer as rustdoc[da35cc98693c420e]::formats::renderer::FormatRenderer>::item
  22:     0x55f3f9c26f87 - <rustdoc[da35cc98693c420e]::json::JsonRenderer as rustdoc[da35cc98693c420e]::formats::renderer::FormatRenderer>::item
  23:     0x55f3f9c26f27 - <rustdoc[da35cc98693c420e]::json::JsonRenderer as rustdoc[da35cc98693c420e]::formats::renderer::FormatRenderer>::item
  24:     0x55f3f9c26f87 - <rustdoc[da35cc98693c420e]::json::JsonRenderer as rustdoc[da35cc98693c420e]::formats::renderer::FormatRenderer>::item
  25:     0x55f3f9c26f87 - <rustdoc[da35cc98693c420e]::json::JsonRenderer as rustdoc[da35cc98693c420e]::formats::renderer::FormatRenderer>::item
  26:     0x55f3f9d9ef6e - rustdoc[da35cc98693c420e]::formats::renderer::run_format::<rustdoc[da35cc98693c420e]::json::JsonRenderer>
  27:     0x55f3f9af35d2 - rustdoc[da35cc98693c420e]::run_renderer::<rustdoc[da35cc98693c420e]::json::JsonRenderer>
  28:     0x55f3f9db8d68 - <rustc_session[2ec63f124a1a20e1]::session::Session>::time::<core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>, rustdoc[da35cc98693c420e]::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#2}>
  29:     0x55f3f9ce9538 - <rustc_interface[3f0e16ab3f9f028a]::passes::QueryContext>::enter::<rustdoc[da35cc98693c420e]::main_options::{closure#0}::{closure#0}::{closure#1}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>
  30:     0x55f3f9bd5999 - <rustc_interface[3f0e16ab3f9f028a]::interface::Compiler>::enter::<rustdoc[da35cc98693c420e]::main_options::{closure#0}::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>
  31:     0x55f3f9e13f11 - rustc_span[9601ff5af35df49b]::with_source_map::<core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>, rustc_interface[3f0e16ab3f9f028a]::interface::create_compiler_and_run<core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>, rustdoc[da35cc98693c420e]::main_options::{closure#0}>::{closure#1}>
  32:     0x55f3f9c0568c - rustc_interface[3f0e16ab3f9f028a]::interface::create_compiler_and_run::<core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>, rustdoc[da35cc98693c420e]::main_options::{closure#0}>
  33:     0x55f3f9af6a70 - rustdoc[da35cc98693c420e]::main_options
  34:     0x55f3f9ce669c - <scoped_tls[a483a1011af12e7b]::ScopedKey<rustc_span[9601ff5af35df49b]::SessionGlobals>>::set::<rustdoc[da35cc98693c420e]::main_args::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>
  35:     0x55f3f9d7d470 - std[e1c98a26831e884c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3f0e16ab3f9f028a]::util::run_in_thread_pool_with_globals<rustdoc[da35cc98693c420e]::main_args::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>
  36:     0x55f3f9c0d9d8 - <<std[e1c98a26831e884c]::thread::Builder>::spawn_unchecked_<rustc_interface[3f0e16ab3f9f028a]::util::run_in_thread_pool_with_globals<rustdoc[da35cc98693c420e]::main_args::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>::{closure#0}, core[104d4c2fa3822a9e]::result::Result<(), rustc_errors[f2be49721dffa37f]::ErrorGuaranteed>>::{closure#1} as core[104d4c2fa3822a9e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f3732a2c4e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hda2f928af025a78b
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/alloc/src/boxed.rs:1935:9
  38:     0x7f3732a2c4e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9bd78ed494fef80b
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/alloc/src/boxed.rs:1935:9
  39:     0x7f3732a2c4e3 - std::sys::unix::thread::Thread::new::thread_start::h1972473febc5ebc9
                               at /rustc/75b7e52e92c3b00fc891b47f5b2efdff0a2be55a/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7f3732775e2d - start_thread
                               at /usr/src/debug/glibc-2.35-15.fc36.x86_64/nptl/pthread_create.c:442:8
  41:     0x7f37327fb1b0 - __clone3
                               at /usr/src/debug/glibc-2.35-15.fc36.x86_64/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  42:                0x0 - <unknown>

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.65.0-nightly (75b7e52e9 2022-08-13) running on x86_64-unknown-linux-gnu

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
error: could not document `vue-sfc`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name vue_sfc src/lib.rs -o /home/martin/Downloads/rust-vue-sfc-0.3.2/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -Z unstable-options --output-format json -C metadata=e2c874287dd69323 -L dependency=/home/martin/Downloads/rust-vue-sfc-0.3.2/target/debug/deps --extern memchr=/home/martin/Downloads/rust-vue-sfc-0.3.2/target/debug/deps/libmemchr-09421297eb8835cb.rmeta --extern nom=/home/martin/Downloads/rust-vue-sfc-0.3.2/target/debug/deps/libnom-d906f14b85917df1.rmeta --crate-version 0.3.2` (exit status: 101)

@rustbot labels +A-rustdoc-json +T-rustdoc +I-ICE +requires-nightly

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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. labels Aug 14, 2022
@aDotInTheVoid
Copy link
Member

@rustbot modify labels: +E-needs-mcve

@rustbot rustbot added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Aug 14, 2022
@Enselic
Copy link
Member Author

Enselic commented Aug 14, 2022

Same ICE can also be reproduced with https://github.com/Kijewski/tzdb/archive/refs/tags/v0.4.3.zip which crater also found

@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Aug 14, 2022

MCVE

pub enum ParseError {
    UnexpectedEndTag(#[doc(hidden)] String),
}

The tzdb ice is the same issue, it also used #[doc(hidden)] on enum fields: https://github.com/Kijewski/tzdb/blob/3970d8159734bbc61be0b17f04e91f3274ba3b86/src/now.rs#L49.

Could you rename the issue?

@rustbot modify labels: -E-needs-mcve

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Aug 14, 2022
@Enselic Enselic changed the title rustdoc JSON ICE with vue-sfc 0.3.2 rustdoc JSON ICE with #[doc(hidden)] on enum tuple field Aug 14, 2022
@GuillaumeGomez
Copy link
Member

Thanks for the MCVE! I'm planning to work on it tomorrow if no one did until then.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 15, 2022
…ed-enum-variant, r=notriddle

[rustdoc] Fix handling of stripped enum variant in JSON output format

Fixes rust-lang#100529.

cc `@aDotInTheVoid` `@Enselic`
r? `@notriddle`
@bors bors closed this as completed in fba3004 Aug 15, 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 I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

4 participants