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 panics at doc comments with only an line break #95800

Closed
91khr opened this issue Apr 8, 2022 · 1 comment · Fixed by #95804
Closed

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

91khr opened this issue Apr 8, 2022 · 1 comment · Fixed by #95804
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.

Comments

@91khr
Copy link
Contributor

91khr commented Apr 8, 2022

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
@91khr 91khr 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 Apr 8, 2022
@GuillaumeGomez
Copy link
Member

I'll take a look.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Apr 8, 2022
…th-backline, r=notriddle

rustdoc: Fix empty doc comment with backline ICE

Fixes rust-lang#95800.

r? `@notriddle`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Apr 9, 2022
…th-backline, r=notriddle

rustdoc: Fix empty doc comment with backline ICE

Fixes rust-lang#95800.

r? ``@notriddle``
@bors bors closed this as completed in 8f4680e Apr 9, 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. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants