Skip to content

rustdoc --theme-checker panics when given an empty file #61145

Closed
@lambda-fairy

Description

@lambda-fairy

When I run the following commands:

touch empty-file.css
RUST_BACKTRACE=1 rustdoc -Z unstable-options --theme-checker empty-file.css

Rustdoc outputs the following:

rustdoc: [theme-checker] Starting tests!
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', src/librustdoc/theme.rs:114:15
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   6: rust_begin_unwind
             at src/libstd/panicking.rs:308
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:61
   9: rustdoc::theme::load_css_paths
  10: rustdoc::theme::test_theme_against
  11: rustdoc::config::Options::from_matches
  12: rustdoc::main_args
 - Checking "empty-file.css"...

I would have expected it to output a list of missing rules, without panicking.

Meta

rustc --version --verbose:

rustc 1.36.0-nightly (dec4c5201 2019-05-24)
binary: rustc
commit-hash: dec4c5201f88efbc3020b04ba96a5ee2c3b6cfcd
commit-date: 2019-05-24
host: x86_64-unknown-linux-gnu
release: 1.36.0-nightly
LLVM version: 8.0

Metadata

Metadata

Labels

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