Skip to content

Rustdoc crashes on broken code #33678

Closed
Closed
@Manishearth

Description

@Manishearth

(If you want to work on this, see this comment)

pub struct Foo(String);

impl Iterator for Foo {
  type Item = String;
  /// yo yo
  fn next(&mut self) -> Option<String> {
    Some(self.0)
  }
}

gives

$ RUST_BACKTRACE=1 rustdoc crash.rs
crash.rs:7:10: 7:14 error: cannot move out of borrowed content [E0507]
crash.rs:7     Some(self.0)
                    ^~~~
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/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:325
stack backtrace:
   1:     0x7fdf2c31c0e0 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
   2:     0x7fdf2c329ceb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   3:     0x7fdf2c32988c - std::panicking::default_hook::hc2c969e7453d080c
   4:     0x7fdf2c2ef2b8 - std::panicking::rust_panic_with_hook::hfe203e3083c2b544
   5:     0x7fdf2c329f31 - std::panicking::begin_panic::h4889569716505182
   6:     0x7fdf2c2f135a - std::panicking::begin_panic_fmt::h484cd47786497f03
   7:     0x7fdf2c329ece - rust_begin_unwind
   8:     0x7fdf2c3739bf - core::panicking::panic_fmt::h257ceb0aa351d801
   9:     0x7fdf2c3744b8 - core::panicking::panic::h4bb1497076d04ab9
  10:     0x7fdf2c86f41d - rustdoc::core::run_core::hb4f6a9182e0af11b
  11:     0x7fdf2c867835 - std::panicking::try::call::h0edabd498a0d5785
  12:     0x7fdf2c33848b - __rust_try
  13:     0x7fdf2c33842e - __rust_maybe_catch_panic
  14:     0x7fdf2c8695c5 - _<F as std..boxed..FnBox<A>>::call_box::he57876f7aa4d18c3
  15:     0x7fdf2c327df4 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  16:     0x7fdf244206a9 - start_thread
  17:     0x7fdf2bf75eec - clone
  18:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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