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: rustdoc: json output and #[doc(inline)] #110138

Closed
matthiaskrgr opened this issue Apr 10, 2023 · 2 comments
Closed

ICE: rustdoc: json output and #[doc(inline)] #110138

matthiaskrgr opened this issue Apr 10, 2023 · 2 comments
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) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

I tried this code:
rustdoc rd.rs -Zunstable-options --output-format json

#[doc(inline)]
#[doc(inline)]
pub extern crate core;

fn main() {}

I expected to see this happen: explanation

Instead, this happened: explanation

Meta

rustc --version --verbose:

rustdoc 1.70.0-nightly (696aaad58 2023-04-09)
binary: rustdoc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.2
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustdoc/json/conversions.rs:747:34
stack backtrace:
   0:     0x7f5b7b364f0a - std::backtrace_rs::backtrace::libunwind::trace::hd26deac9c5400510
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5b7b364f0a - std::backtrace_rs::backtrace::trace_unsynchronized::h0d525c5df19c5fb3
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5b7b364f0a - std::sys_common::backtrace::_print_fmt::hfa46a4e5b1417412
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f5b7b364f0a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd35deac25c2a2361
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5b7b3c8fcf - core::fmt::write::h57692caee39fe498
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f5b7b357a45 - std::io::Write::write_fmt::h3cf8ad4e45a4d8c5
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/io/mod.rs:1698:15
   6:     0x7f5b7b364cd5 - std::sys_common::backtrace::_print::hdf25b99ab69d47c1
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f5b7b364cd5 - std::sys_common::backtrace::print::hf7d8e454ceffbfe6
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f5b7b36797e - std::panicking::default_hook::{{closure}}::hd867f5f971a369e7
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:269:22
   9:     0x7f5b7b367725 - std::panicking::default_hook::habf6eee7b304b436
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:288:9
  10:     0x7f5b7e655665 - rustc_driver_impl[2d97b4318b2b8966]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f5b7b368174 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0aac6d981c9df2cb
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1990:9
  12:     0x7f5b7b368174 - std::panicking::rust_panic_with_hook::h0ae6f6705c097c51
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:694:13
  13:     0x7f5b7b367ea2 - std::panicking::begin_panic_handler::{{closure}}::hbe8782e7e80a84bd
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:579:13
  14:     0x7f5b7b365376 - std::sys_common::backtrace::__rust_end_short_backtrace::hc6aeb922005c62a1
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f5b7b367c42 - rust_begin_unwind
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:577:5
  16:     0x7f5b7b3c52e3 - core::panicking::panic_fmt::h558c06d837516a28
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/panicking.rs:67:14
  17:     0x7f5b7b3c537d - core::panicking::panic::hee3e155c560a4e20
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/panicking.rs:117:5
  18:     0x55de8d1dc456 - <rustdoc_json_types[166709aa9cefdb0]::Discriminant as rustdoc[97ff839e1c69ca68]::json::conversions::FromWithTcx<rustdoc[97ff839e1c69ca68]::clean::types::Discriminant>>::from_tcx
  19:     0x55de8d1dc205 - <rustdoc_json_types[166709aa9cefdb0]::Variant as rustdoc[97ff839e1c69ca68]::json::conversions::FromWithTcx<rustdoc[97ff839e1c69ca68]::clean::types::Variant>>::from_tcx
  20:     0x55de8d21e68b - rustdoc[97ff839e1c69ca68]::json::conversions::from_clean_item
  21:     0x55de8d264a7f - <rustdoc[97ff839e1c69ca68]::json::JsonRenderer as rustdoc[97ff839e1c69ca68]::formats::renderer::FormatRenderer>::item
  22:     0x55de8d2644b9 - <rustdoc[97ff839e1c69ca68]::json::JsonRenderer as rustdoc[97ff839e1c69ca68]::formats::renderer::FormatRenderer>::item
  23:     0x55de8d2644b9 - <rustdoc[97ff839e1c69ca68]::json::JsonRenderer as rustdoc[97ff839e1c69ca68]::formats::renderer::FormatRenderer>::item
  24:     0x55de8d2644b9 - <rustdoc[97ff839e1c69ca68]::json::JsonRenderer as rustdoc[97ff839e1c69ca68]::formats::renderer::FormatRenderer>::item
  25:     0x55de8d2644b9 - <rustdoc[97ff839e1c69ca68]::json::JsonRenderer as rustdoc[97ff839e1c69ca68]::formats::renderer::FormatRenderer>::item
  26:     0x55de8d1c9426 - rustdoc[97ff839e1c69ca68]::formats::renderer::run_format::<rustdoc[97ff839e1c69ca68]::json::JsonRenderer>
  27:     0x55de8cf8a51a - rustdoc[97ff839e1c69ca68]::run_renderer::<rustdoc[97ff839e1c69ca68]::json::JsonRenderer>
  28:     0x55de8d12d6ca - <rustc_session[ca8de67c023859ee]::session::Session>::time::<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#2}>
  29:     0x55de8d26fd30 - <std[3958f564ddc007dc]::thread::local::LocalKey<core[df85f84a2bdb4263]::cell::Cell<*const ()>>>::with::<rustc_middle[9ae9af9eb73fc3b1]::ty::context::tls::enter_context<<rustc_middle[9ae9af9eb73fc3b1]::ty::context::GlobalCtxt>::enter<rustdoc[97ff839e1c69ca68]::main_args::{closure#1}::{closure#0}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  30:     0x55de8d17c39b - <rustc_interface[5859b4daf695f246]::queries::QueryResult<&rustc_middle[9ae9af9eb73fc3b1]::ty::context::GlobalCtxt>>::enter::<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}::{closure#0}::{closure#0}>
  31:     0x55de8cfc725e - <rustc_interface[5859b4daf695f246]::interface::Compiler>::enter::<rustdoc[97ff839e1c69ca68]::main_args::{closure#1}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  32:     0x55de8d17a1db - rustc_span[24111c70308d7d50]::set_source_map::<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}>::{closure#0}::{closure#0}>
  33:     0x55de8cfc8d03 - <scoped_tls[5f4f1a448a290364]::ScopedKey<rustc_span[24111c70308d7d50]::SessionGlobals>>::set::<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  34:     0x55de8cf57769 - std[3958f564ddc007dc]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5859b4daf695f246]::util::run_in_thread_pool_with_globals<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  35:     0x55de8d203cdd - <<std[3958f564ddc007dc]::thread::Builder>::spawn_unchecked_<rustc_interface[5859b4daf695f246]::util::run_in_thread_pool_with_globals<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustdoc[97ff839e1c69ca68]::main_args::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#1} as core[df85f84a2bdb4263]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7f5b7b372255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h40268ec1e3f75121
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976:9
  37:     0x7f5b7b372255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb4cdee1772a16528
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976:9
  38:     0x7f5b7b372255 - std::sys::unix::thread::Thread::new::thread_start::h71a921bd46112f49
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7f5b7afffbb5 - <unknown>
  40:     0x7f5b7b081d90 - <unknown>
  41:                0x0 - <unknown>

error: 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.70.0-nightly (696aaad58 2023-04-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. A-rustdoc-json Area: Rustdoc JSON backend S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Apr 10, 2023
@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Apr 10, 2023

Or even simpler:

#[doc(inline)]
pub extern crate core;

@matthiaskrgr matthiaskrgr changed the title ICE: rustdoc: json output , duplicate #[doc(inline)] ICE: rustdoc: json output and #[doc(inline)] Apr 10, 2023
JohnTitor added a commit to JohnTitor/rust that referenced this issue Apr 11, 2023
fix(doc): do not parse inline when output is json for external crate

relative rust-lang#110138
JohnTitor added a commit to JohnTitor/rust that referenced this issue Apr 11, 2023
fix(doc): do not parse inline when output is json for external crate

relative rust-lang#110138
@GuillaumeGomez
Copy link
Member

Fixed by #110146.

jyn514 added a commit to jyn514/rust that referenced this issue Apr 26, 2023
…=jyn514

Improve tests for rust-lang#110138

These should live in rustdoc-json, not rustdoc-ui, so we can run assertions, and not just check there's no ICE

CC rust-lang#100515, as we never document this suite

r? rustdoc
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 26, 2023
Rollup of 9 pull requests

Successful merges:

 - rust-lang#108416 (black_box doc corrections for clarification - Issue rust-lang#107957)
 - rust-lang#109379 (Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs`)
 - rust-lang#110266 (Update documentation wording on path 'try_exists' functions)
 - rust-lang#110329 (Improve tests for rust-lang#110138)
 - rust-lang#110418 (Spelling rustdoc)
 - rust-lang#110587 (Fix `std` compilation error for wasi+atomics)
 - rust-lang#110594 (`rustc --help` add `--cfg` SPEC declaration.)
 - rust-lang#110792 (Use the standard macOS CI runner)
 - rust-lang#110817 (Add regression tests for const-generic inherent associated types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
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) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants