-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
In certain circumstances, a nul in a docstring causes rustdoc to panic with a NulError.
I tried this code:
#[macro_use]
extern crate error_chain;
error_chain! {
foreign_links {
StringContainsNul(::std::ffi::NulError)
#[doc = "Attempted to pass a string containing `\0`"];
}
}
(See https://gist.github.com/kw217/4687d8c42b890f8f7c75533f64cb00c8)
Notice the probably-wrong literal nul char in the docstring - the author intended to use a double-backslash.
When I ran cargo doc, I expected this to either work (emitting HTML output containing the literal nul or somehow eliding it) or give me an appropriate error message (e.g., "Docstring contains NUL at lib.rs:7").
Instead, I got the following panic:
$ RUST_BACKTRACE=1 cargo doc
Documenting repro v0.1.0 (file:///data/ksw/repro)
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 `Result::unwrap()` on an `Err` value: NulError(6, [60, 99, 111, 100, 101, 62, 0, 60, 47, 99, 111, 100, 101, 62])', /checkout/src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:355
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:365
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:549
5: std::panicking::begin_panic
at /checkout/src/libstd/panicking.rs:511
6: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:495
7: rust_begin_unwind
at /checkout/src/libstd/panicking.rs:471
8: core::panicking::panic_fmt
at /checkout/src/libcore/panicking.rs:69
9: core::result::unwrap_failed
10: rustdoc::html::markdown::render::codespan
11: char_codespan
12: parse_inline
13: parse_block.part.19
14: hoedown_document_render
15: rustdoc::html::markdown::render
16: core::fmt::write
at /checkout/src/libcore/fmt/mod.rs:954
17: core::fmt::Formatter::write_fmt
at /checkout/src/libcore/fmt/mod.rs:1262
18: rustdoc::html::render::document_full
19: <rustdoc::html::render::Item<'a> as core::fmt::Display>::fmt
20: core::fmt::write
at /checkout/src/libcore/fmt/mod.rs:994
at /checkout/src/libcore/fmt/mod.rs:962
21: std::io::Write::write_fmt
22: rustdoc::html::render::Context::render_item
23: rustdoc::html::render::run
error: Could not document `repro`.
Caused by:
process didn't exit successfully: `rustdoc --crate-name repro src/lib.rs -o /data/ksw/repro/target/doc -L dependency=/data/ksw/repro/target/debug/deps --extern error_chain=/data/ksw/repro/target/debug/deps/liberror_chain-4a7bcc9cb68d5e79.rlib` (exit code: 101)
Meta
rustc --version --verbose
:
rustc 1.19.0 (0ade33941 2017-07-17)
binary: rustc
commit-hash: 0ade339411587887bf01bcfa2e9ae4414c8900d4
commit-date: 2017-07-17
host: x86_64-unknown-linux-gnu
release: 1.19.0
LLVM version: 4.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.