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 ICE when collecting intra-doc links #65840

Closed
Michael-F-Bryan opened this issue Oct 26, 2019 · 3 comments · Fixed by #66211
Closed

Rustdoc ICE when collecting intra-doc links #65840

Michael-F-Bryan opened this issue Oct 26, 2019 · 3 comments · Fixed by #66211
Labels
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

@Michael-F-Bryan
Copy link

I found an ICE when trying to document the spirit-log crate on the latest nightly.

Skimming through the backtrace, it looks like rustdoc::clean::inline::record_extern_fqn accessed an invalid index while traversing links within rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links.

Steps to reproduce:

$ cd /tmp
$ git clone git@github.com:vorner/spirit.git  
Cloning into 'spirit'...
remote: Enumerating objects: 40, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 3182 (delta 9), reused 11 (delta 2), pack-reused 3142
Receiving objects: 100% (3182/3182), 1019.71 KiB | 1.10 MiB/s, done.
Resolving deltas: 100% (1890/1890), done.
$ cd spirit/spirit-log
$ git checkout 7c52608689fd1488c26ccaa0520e9dd926e7501c
$ uname -a
Linux laptop 5.0.0-32-generic #34-Ubuntu SMP Wed Oct 2 02:06:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ rustc --version --verbose
rustc 1.40.0-nightly (246be7e1a 2019-10-25)
binary: rustc
commit-hash: 246be7e1a557b8ac8287c6842379a0db67770be6
commit-date: 2019-10-25
host: x86_64-unknown-linux-gnu
release: 1.40.0-nightly
LLVM version: 9.0
$ cargo --version --verbose
cargo 1.40.0-nightly (3ba5f2717 2019-10-22)
release: 1.40.0
commit-hash: 3ba5f27170db10af7a92f2b682e049397197b8fa
commit-date: 2019-10-22
$ RUST_BACKTRACE=full cargo doc
 Documenting spirit v0.4.0 (/tmp/spirit)
warning: `[crate::log_error]` cannot be resolved, ignoring it...
   --> src/lib.rs:453:20
    |
453 | //! [`log_error`]: macro@crate::log_error
    |                    ^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
    |
    = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

thread 'rustc' panicked at 'index out of bounds: the len is 40 but the index is 40', /rustc/246be7e1a557b8ac8287c6842379a0db67770be6/src/libcore/slice/mod.rs:2796:10
stack backtrace:
   0:     0x7ff9a3a45014 - backtrace::backtrace::libunwind::trace::hab3225e15f119ae0
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:     0x7ff9a3a45014 - backtrace::backtrace::trace_unsynchronized::hbaf4bc94065e3599
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:     0x7ff9a3a45014 - std::sys_common::backtrace::_print_fmt::hbee4e41845713fe0
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7ff9a3a45014 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb733ceb939af72e6
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x7ff9a3a7d58c - core::fmt::write::h6610df6b014c1fa3
                               at src/libcore/fmt/mod.rs:1028
   5:     0x7ff9a3a393f7 - std::io::Write::write_fmt::h38d85ee16f610932
                               at src/libstd/io/mod.rs:1412
   6:     0x7ff9a3a4983e - std::sys_common::backtrace::_print::h061c5d660abcf8d1
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x7ff9a3a4983e - std::sys_common::backtrace::print::hc28d1c154d74f5b9
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x7ff9a3a4983e - std::panicking::default_hook::{{closure}}::h53bff1f7c2aed77d
                               at src/libstd/panicking.rs:188
   9:     0x7ff9a3a49541 - std::panicking::default_hook::hf02412a75b646f46
                               at src/libstd/panicking.rs:205
  10:     0x7ff9a3a4a01c - std::panicking::rust_panic_with_hook::h9226e8f020e126d7
                               at src/libstd/panicking.rs:472
  11:     0x7ff9a3a49ad2 - std::panicking::continue_panic_fmt::hdf2b5cc8fe9d1e3b
                               at src/libstd/panicking.rs:375
  12:     0x7ff9a3a499c6 - rust_begin_unwind
                               at src/libstd/panicking.rs:302
  13:     0x7ff9a3a770fa - core::panicking::panic_fmt::h794f55f0674340d0
                               at src/libcore/panicking.rs:84
  14:     0x7ff9a3a770b5 - core::panicking::panic_bounds_check::h64960dc7d578ef8d
                               at src/libcore/panicking.rs:61
  15:     0x7ff9a53eb464 - rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::cstore::CStore>::crate_data_as_any::h87dcab865adcdf0f
  16:     0x7ff9a53510eb - rustc_metadata::cstore_impl::provide_extern::crate_name::h0cc0624b2d4e6ceb
  17:     0x558f283c4bf5 - rustc::ty::query::__query_compute::crate_name::ha39afb20634a4f73
  18:     0x558f281a196d - rustc::dep_graph::graph::DepGraph::with_task_impl::hf35e82810c3323b8
  19:     0x558f28296539 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hb6252697cb67bd63
  20:     0x558f283717b8 - rustdoc::clean::inline::record_extern_fqn::hc1fa57ee322c2fed
  21:     0x558f283dbdb4 - rustdoc::clean::register_res::habd605d2ad378dad
  22:     0x558f281b2edb - <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item::hdaf2eac19e0789e6
  23:     0x558f28209f49 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h405df7c23303ea9c
  24:     0x558f281a26c6 - rustdoc::fold::DocFolder::fold_inner_recur::h9d8c41801488ba12
  25:     0x558f281a3386 - rustdoc::fold::DocFolder::fold_item_recur::hc7107c01ae876a28
  26:     0x558f281b579a - <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item::hdaf2eac19e0789e6
  27:     0x558f28209f49 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h405df7c23303ea9c
  28:     0x558f281a26c6 - rustdoc::fold::DocFolder::fold_inner_recur::h9d8c41801488ba12
  29:     0x558f281a3386 - rustdoc::fold::DocFolder::fold_item_recur::hc7107c01ae876a28
  30:     0x558f281b579a - <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item::hdaf2eac19e0789e6
  31:     0x558f281b5eb7 - <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_crate::h5d79100f4dec5efd
  32:     0x558f281afebb - rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links::hde2b2e326618ebd5
  33:     0x558f28238976 - rustc::ty::context::tls::enter_global::hc78871115590302e
  34:     0x558f282b5ce7 - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h38489c11c78915c2
  35:     0x7ff9a42cfb7a - rustc_interface::passes::create_global_ctxt::{{closure}}::hb862dbb4d2ca887a
  36:     0x558f282b5972 - rustc_interface::passes::BoxedGlobalCtxt::enter::hd8b6203cb3e50951
  37:     0x558f28379b6a - rustdoc::core::run_core::hd924c9677a0f5ecd
  38:     0x558f28227940 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hc921e38d2a98e856
  39:     0x558f283520cb - std::panicking::try::do_call::h54d3c25b1f4a03c4
  40:     0x7ff9a3a5a8ba - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  41:     0x558f283ab09b - rustc_driver::catch_fatal_errors::hef91d7f5a3f99d5f
  42:     0x558f281b8d7a - rustdoc::main_options::h96b421dcabb1372f
  43:     0x558f283059b5 - std::thread::local::LocalKey<T>::with::haa8ef269ff0079b5
  44:     0x558f282b1d4e - scoped_tls::ScopedKey<T>::set::h5ad613cd4536582c
  45:     0x558f283c8d62 - syntax::with_globals::h16e602af63553392
  46:     0x558f2822ac0d - std::sys_common::backtrace::__rust_begin_short_backtrace::ha20ec3782fd09249
  47:     0x7ff9a3a5a8ba - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  48:     0x558f2822d0f9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc22b265702fb1f87
  49:     0x7ff9a3a2b44f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h048fda3ebc391397
                               at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6/src/liballoc/boxed.rs:942
  50:     0x7ff9a3a592e0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h76e6cb3f56f40d59
                               at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6/src/liballoc/boxed.rs:942
  51:     0x7ff9a3a592e0 - std::sys_common::thread::start_thread::ha21bc807781f4e78
                               at src/libstd/sys_common/thread.rs:13
  52:     0x7ff9a3a592e0 - std::sys::unix::thread::Thread::new::thread_start::hc839a9e9b07e2e92
                               at src/libstd/sys/unix/thread.rs:79
  53:     0x7ff9a39a5182 - start_thread
  54:     0x7ff9a38b2b1f - __clone
  55:                0x0 - <unknown>
error: Could not document `spirit`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name spirit src/lib.rs -o /tmp/spirit/target/doc --cfg 'feature="cfg-help"' --cfg 'feature="structdoc"' --error-format=json --json=diagnostic-rendered-ansi -L dependency=/tmp/spirit/target/debug/deps --extern arc_swap=/tmp/spirit/target/debug/deps/libarc_swap-74733a42b4d0d636.rmeta --extern config_spirit_fork=/tmp/spirit/target/debug/deps/libconfig_spirit_fork-0dc6526fffa8645b.rmeta --extern either=/tmp/spirit/target/debug/deps/libeither-3c6baf0ffbfa146d.rmeta --extern err_context=/tmp/spirit/target/debug/deps/liberr_context-351c3e6ca14163b9.rmeta --extern fallible_iterator=/tmp/spirit/target/debug/deps/libfallible_iterator-5f4a8f111b20530a.rmeta --extern humantime=/tmp/spirit/target/debug/deps/libhumantime-a10ea5b619150980.rmeta --extern libc=/tmp/spirit/target/debug/deps/liblibc-b0e85993139d10b9.rmeta --extern log=/tmp/spirit/target/debug/deps/liblog-2fe4ad0f0ad43e6b.rmeta --extern serde=/tmp/spirit/target/debug/deps/libserde-8107fdb3ca0f691a.rmeta --extern serde_ignored=/tmp/spirit/target/debug/deps/libserde_ignored-6b5329bf097aa317.rmeta --extern serde_path_to_error=/tmp/spirit/target/debug/deps/libserde_path_to_error-36b50dc734fe2764.rmeta --extern signal_hook=/tmp/spirit/target/debug/deps/libsignal_hook-5a1f3fcdcb7b3bcc.rmeta --extern structdoc=/tmp/spirit/target/debug/deps/libstructdoc-4dc490ea500ee6bd.rmeta --extern structopt=/tmp/spirit/target/debug/deps/libstructopt-c187231a4ba3078a.rmeta --extern toml=/tmp/spirit/target/debug/deps/libtoml-e98a6f8df07be7cc.rmeta` (exit code: 1)
@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 26, 2019
@GuillaumeGomez
Copy link
Member

Taking a look.

@GuillaumeGomez
Copy link
Member

Actually, it's failing outside of rustdoc so I prefer to let someone else handle it.

cc @rust-lang/compiler

@GuillaumeGomez GuillaumeGomez added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 26, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 26, 2019
@kinnison
Copy link
Contributor

kinnison commented Nov 6, 2019

I think this might be a rustdoc bug (or at least mismatch between how rustdoc uses the resolver infrastructure and how it's meant to work). See my comment here: #66159 (comment)

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. 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.

4 participants