Skip to content

Panic in source_span_for_markdown_range #141665

@GuillaumeGomez

Description

@GuillaumeGomez

Seems like we do something wrong with strings indexing.

thread 'rustc' panicked at compiler/rustc_resolve/src/rustdoc.rs:573:52:
byte index 829 is not a char boundary; it is inside '⚠' (bytes 828..831) of `# sysinfo [![][img_crates]][crates] [![][img_doc]][doc]

`sysinfo` is a crate used to get a system's information.

## Supported OSes

It currently supports the following OSes (alphabetically sorted):

 * Android
 * FreeBSD
 * iOS
 * Linux
 * macOS
 * Raspb`[...]
stack backtrace:
   0:     0x7fedf6187f53 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf9e24adbe3047db4
   1:     0x7fedf6805877 - core::fmt::write::h69464b7c3fd5e556
   2:     0x7fedf7976911 - std::io::Write::write_fmt::hb26edb100dd5950f
   3:     0x7fedf6187db2 - std::sys::backtrace::BacktraceLock::print::hb1091998081da5bd
   4:     0x7fedf618b9aa - std::panicking::default_hook::{{closure}}::h7c3d49848ce65ffc
   5:     0x7fedf618b52f - std::panicking::default_hook::h672644795455c113
   6:     0x7fedf51aef53 - std[21fde1207f00070e]::panicking::update_hook::<alloc[1588af6cffbc44e0]::boxed::Box<rustc_driver_impl[456a604eb730744d]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fedf618c223 - std::panicking::rust_panic_with_hook::h4f1cef12e25d9010
   8:     0x7fedf618bf1a - std::panicking::begin_panic_handler::{{closure}}::hb55116864d318499
   9:     0x7fedf6188419 - std::sys::backtrace::__rust_end_short_backtrace::ha8a50b7257306f2c
  10:     0x7fedf618bbdd - __rustc[9b349d1953572bc6]::rust_begin_unwind
  11:     0x7fedf2a8e100 - core::panicking::panic_fmt::h935c41405e3972bf
  12:     0x7fedf4b28038 - core::str::slice_error_fail_rt::h2d86afe338b76f24
  13:     0x7fedf46c87fa - core::str::slice_error_fail::h4bd3819b8b032771
  14:     0x7fedf5d2ea93 - rustc_resolve[7cbb14a8f088e415]::rustdoc::source_span_for_markdown_range
  15:     0x55d0dd339c3e - clippy_lints[b00f0ebaf4999f0]::doc::check_doc::<pulldown_cmark[317fdb1271aed187]::parse::OffsetIter<&mut clippy_lints[b00f0ebaf4999f0]::doc::check_attrs::fake_broken_link_callback>>
  16:     0x55d0dd337798 - <clippy_lints[b00f0ebaf4999f0]::doc::Documentation as rustc_lint[40842392e773dd3f]::passes::LateLintPass>::check_attributes
  17:     0x7fedf770cb42 - rustc_lint[40842392e773dd3f]::late::check_crate::{closure#0}
  18:     0x7fedf770ceab - rustc_lint[40842392e773dd3f]::late::check_crate
  19:     0x7fedf771081f - rustc_interface[a7a41a29f08ea03]::passes::analysis
  20:     0x7fedf77105f5 - rustc_query_impl[601dcc0868136b20]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[601dcc0868136b20]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5eb5ed378518d9da]::query::erase::Erased<[u8; 0usize]>>
  21:     0x7fedf77126fa - rustc_query_system[10aaad7a65d627b6]::query::plumbing::try_execute_query::<rustc_query_impl[601dcc0868136b20]::DynamicConfig<rustc_query_system[10aaad7a65d627b6]::query::caches::SingleCache<rustc_middle[5eb5ed378518d9da]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[601dcc0868136b20]::plumbing::QueryCtxt, false>
  22:     0x7fedf77123cf - rustc_query_impl[601dcc0868136b20]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7fedf79a3207 - rustc_interface[a7a41a29f08ea03]::passes::create_and_enter_global_ctxt::<core[2969579d35182c01]::option::Option<rustc_interface[a7a41a29f08ea03]::queries::Linker>, rustc_driver_impl[456a604eb730744d]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  24:     0x7fedf798744f - rustc_interface[a7a41a29f08ea03]::interface::run_compiler::<(), rustc_driver_impl[456a604eb730744d]::run_compiler::{closure#0}>::{closure#1}
  25:     0x7fedf78acdc6 - std[21fde1207f00070e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a7a41a29f08ea03]::util::run_in_thread_with_globals<rustc_interface[a7a41a29f08ea03]::util::run_in_thread_pool_with_globals<rustc_interface[a7a41a29f08ea03]::interface::run_compiler<(), rustc_driver_impl[456a604eb730744d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:     0x7fedf78aca6b - <<std[21fde1207f00070e]::thread::Builder>::spawn_unchecked_<rustc_interface[a7a41a29f08ea03]::util::run_in_thread_with_globals<rustc_interface[a7a41a29f08ea03]::util::run_in_thread_pool_with_globals<rustc_interface[a7a41a29f08ea03]::interface::run_compiler<(), rustc_driver_impl[456a604eb730744d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[2969579d35182c01]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7fedf78addbd - std::sys::pal::unix::thread::Thread::new::thread_start::h4356d888f81dd7e9
  28:     0x7fedf149caa4 - <unknown>
  29:     0x7fedf1529c3c - <unknown>
  30:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

I'll try to write a small reproducer.

Metadata

Metadata

Assignees

Labels

A-UnicodeArea: UnicodeA-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-markdown-parsingArea: Markdown parsing for doc-commentsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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