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 on ./src/test/ui/traits/trait-object-vs-lifetime-2.rs: index OOB #79467

Closed
matthiaskrgr opened this issue Nov 27, 2020 · 2 comments · Fixed by #98889
Closed

ICE: rustdoc on ./src/test/ui/traits/trait-object-vs-lifetime-2.rs: index OOB #79467

matthiaskrgr opened this issue Nov 27, 2020 · 2 comments · Fixed by #98889
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

code from ./src/test/ui/traits/trait-object-vs-lifetime-2.rs

// A few contrived examples where lifetime should (or should not) be parsed as an object type.
// Lifetimes parsed as types are still rejected later by semantic checks.

// `'static` is a lifetime, `'static +` is a type, `'a` is a type
fn g() where
    'static: 'static,
    dyn 'static +: 'static + Copy,
    //~^ ERROR at least one trait is required for an object type
{}

fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.50.0-nightly (1c389ffef 2020-11-24)
binary: rustdoc
commit-hash: 1c389ffeff814726dec325f0f2b0c99107df2673
commit-date: 2020-11-24
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

error[E0224]: at least one trait is required for an object type
 --> ./src/test/ui/traits/trait-object-vs-lifetime-2.rs:7:5
  |
7 |     dyn 'static +: 'static + Copy,
  |     ^^^^^^^^^^^^^

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', src/librustdoc/clean/mod.rs:1461:23
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.50.0-nightly (1c389ffef 2020-11-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
Backtrace

error[E0224]: at least one trait is required for an object type
 --> ./src/test/ui/traits/trait-object-vs-lifetime-2.rs:7:5
  |
7 |     dyn 'static +: 'static + Copy,
  |     ^^^^^^^^^^^^^

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', src/librustdoc/clean/mod.rs:1461:23
stack backtrace:
   0:     0x7f152b646e30 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f152b646e30 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f152b646e30 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f152b646e30 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f152b6b9c4c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f152b6389a2 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/io/mod.rs:1519:15
   6:     0x7f152b64aa95 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f152b64aa95 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f152b64aa95 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:208:50
   9:     0x7f152b64a5ea - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:225:9
  10:     0x7f152bed7bb8 - rustc_driver::report_ice::ha25ae86a5858acc3
  11:     0x7f152b64b396 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:595:17
  12:     0x7f152b64aeb7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:497:13
  13:     0x7f152b6472ec - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f152b64ae19 - rust_begin_unwind
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:493:5
  15:     0x7f152b6b6031 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/panicking.rs:92:14
  16:     0x7f152b6b5ff2 - core::panicking::panic_bounds_check::h5752306d250b5620
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/panicking.rs:69:5
  17:     0x5633d2986e7a - <rustc_hir::hir::Ty as rustdoc::clean::Clean<rustdoc::clean::types::Type>>::clean::h7e12b892841ced7b
  18:     0x5633d298118b - <rustc_hir::hir::WherePredicate as rustdoc::clean::Clean<rustdoc::clean::types::WherePredicate>>::clean::hf2e322efaf06dc70
  19:     0x5633d298232f - <rustc_hir::hir::Generics as rustdoc::clean::Clean<rustdoc::clean::types::Generics>>::clean::hc30c3f91e19a62bf
  20:     0x5633d2a12168 - rustdoc::clean::utils::enter_impl_trait::h89ecd5f85c6cf117
  21:     0x5633d298a339 - <(&rustc_hir::hir::Item,core::option::Option<rustc_span::symbol::Ident>) as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::types::Item>>>::clean::h6efe2622d62f0879
  22:     0x5633d2a9601f - <alloc::vec::Vec<T,A> as alloc::vec::SpecExtend<T,I>>::spec_extend::hbf27f2437fec8031
  23:     0x5633d2a12de8 - <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::types::Item>>::clean::hee8955bac14e83bc
  24:     0x5633d2a0c153 - rustdoc::clean::utils::krate::h68bb50ab032123ce
  25:     0x5633d2787b3b - rustdoc::core::run_global_ctxt::h7cf39be6ea65128e
  26:     0x5633d2801ece - rustc_interface::passes::QueryContext::enter::hedb615e17429b641
  27:     0x5633d28f7917 - rustc_interface::interface::create_compiler_and_run::h25fa5935e40978f2
  28:     0x5633d279e0d3 - rustdoc::main_options::h8a5cda9c1c8c625b
  29:     0x5633d28e8a68 - rustc_span::with_session_globals::h7a83fbbd64fb6823
  30:     0x5633d27cf30e - std::sys_common::backtrace::__rust_begin_short_backtrace::h50722f4a01515f7b
  31:     0x5633d290103a - core::ops::function::FnOnce::call_once{{vtable.shim}}::h22276985fb540191
  32:     0x7f152b65a65a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  33:     0x7f152b65a65a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/alloc/src/boxed.rs:1318:9
  34:     0x7f152b65a65a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys/unix/thread.rs:71:17
  35:     0x7f152b5363e9 - start_thread
  36:     0x7f152b31c293 - __GI___clone
  37:                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.50.0-nightly (1c389ffef 2020-11-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0224`.

@matthiaskrgr matthiaskrgr 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 Nov 27, 2020
@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 20, 2020

I think this is the code crashing:

match bounds[0].clean(cx).trait_ {

Assigning P-low by the same rationale as #79496 (comment), but I expect this to be much easier to fix than #79495, #79494, or #79468.

@jyn514 jyn514 added the P-low Low priority label Dec 20, 2020
@matthiaskrgr
Copy link
Member Author

No longer crashing:

error[E0224]: at least one trait is required for an object type
 --> out.rs:7:5
  |
7 |     dyn 'static +: 'static + Copy,
  |     ^^^^^^^^^^^^^

error: aborting due to previous error

@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Feb 18, 2022
@TaKO8Ki TaKO8Ki self-assigned this Jul 4, 2022
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jul 4, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 5, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 5, 2022
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#98860 (adjust dangling-int-ptr error message)
 - rust-lang#98888 (interpret: fix CheckedBinOp behavior when overflow checking is disabled)
 - rust-lang#98889 (Add regression test for rust-lang#79467)
 - rust-lang#98895 (bootstrap.py: Always use `.exe` for Windows)
 - rust-lang#98920 (adapt issue-37945 codegen test to accept any order of ops)
 - rust-lang#98921 (Refactor: remove a redundant mutable variable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 70ade7d Jul 5, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority 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