Skip to content

Rustdoc panics at doc comments with only an line break #95800

@91khr

Description

@91khr

Code

/*! */

Meanwhile, /*! */ (any amount of spaces) and #![doc=""], #![doc="\n"], #![doc=r#"(line break)"#] can all be processed correctly; if there is anything more than just a line break (e.g. spaces before */ or after /*!), the doc comment can be processed correctly too.

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (76d770ac2 2022-04-02) binary: rustc commit-hash: 76d770ac21d9521db6a92a48c7b3d5b2cc535941 commit-date: 2022-04-02 host: x86_64-unknown-linux-gnu release: 1.61.0-nightly LLVM version: 14.0.0 

Error output

There is no output, the backtrace of rustdoc is:

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_ast/src/util/comments.rs:55:28 stack backtrace: 0: rust_begin_unwind at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panicking.rs:143:14 2: core::panicking::panic_bounds_check at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panicking.rs:84:5 3: rustc_ast::util::comments::beautify_doc_string 4: <unknown> 5: <unknown> 6: <unknown> 7: <unknown> 8: <unknown> 9: <unknown> 10: <unknown> 11: <unknown> 12: <unknown> 13: <unknown> 14: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9 15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9 16: std::sys::unix::thread::Thread::new::thread_start at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys/unix/thread.rs:108:17 17: start_thread 18: __clone note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.61.0-nightly (76d770ac2 2022-04-02) running on x86_64-unknown-linux-gnu query stack during panic: end of query stack 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler 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