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 - redundant_explicit_links panics on unicode ellipsis inside backticks #115250

Closed
danjl1100 opened this issue Aug 26, 2023 · 5 comments
Closed
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@danjl1100
Copy link

danjl1100 commented Aug 26, 2023

Code

I am having trouble finding a minimal example, as just copying the doc comment and #[deny(...)] lines from bumpalo is not triggering the error.

Example doc comment in bumpalo@3.11.1:

/// the matching [`…alloc_with(|| x)`](?search=alloc_with). However if you use
                   ^-- ellipsis

Reproduction case using cargo is shown below. I don't think this is specific to bumpalo, just that happened to be the dependency that caused the error for my project (since it has unicode ellipsis inside backticks in some doc comments).

$ cargo new --lib doc_ice_115250
$ cd doc_ice_115250/
$ cargo add bumpalo@3.11.1
$ cargo doc
 # rustc panic, see below

Meta

rustc --version --verbose:

rustc 1.73.0-beta.1 (680cdf816 2023-08-21)
binary: rustc
commit-hash: 680cdf8168a906b4ea80af673c64e4a16f77be57
commit-date: 2023-08-21
host: x86_64-unknown-linux-gnu
release: 1.73.0-beta.1
LLVM version: 17.0.0

Error output

 Documenting bumpalo v3.13.0
    Checking bumpalo v3.13.0
thread 'rustc' panicked at src/librustdoc/passes/lint/redundant_explicit_links.rs:107:41:
byte index 1 is not a char boundary; it is inside '…' (bytes 0..3) of `…alloc_with(|| x)`
stack backtrace:
   0:     0x7ffff39630fc - std::backtrace_rs::backtrace::libunwind::trace::h2735517c1857b7ac
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffff39630fc - std::backtrace_rs::backtrace::trace_unsynchronized::hf9177b97a126b282
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffff39630fc - std::sys_common::backtrace::_print_fmt::h2e15a1c5b347a299
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7ffff39630fc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5349d15174bef316
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffff39c93bc - core::fmt::rt::Argument::fmt::hf7848e265af79e1f
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/fmt/rt.rs:138:9
   5:     0x7ffff39c93bc - core::fmt::write::hbde61702c56c8f5f
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ffff3955b2e - std::io::Write::write_fmt::h064308c6d4b3b51c
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/io/mod.rs:1714:15
   7:     0x7ffff3962ee4 - std::sys_common::backtrace::_print::h9568a7b6112c6b29
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ffff3962ee4 - std::sys_common::backtrace::print::hf01ef999a96ddebe
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ffff3965fda - std::panicking::panic_hook_with_disk_dump::{{closure}}::h80a06791c2b4e0bd
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:278:22
  10:     0x7ffff3965cc7 - std::panicking::panic_hook_with_disk_dump::h41378fbd0b9324e5
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:312:9
  11:     0x7ffff6b05929 - <rustc_driver_impl[e639b49598884b8a]::install_ice_hook::{closure#0} as core[adbc28648fe68309]::ops::function::FnOnce<(&core[adbc28648fe68309]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7ffff3966880 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hca49758b2921d01d
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/alloc/src/boxed.rs:2021:9
  13:     0x7ffff3966880 - std::panicking::rust_panic_with_hook::h6c0a3ee1013fc764
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:733:13
  14:     0x7ffff3966607 - std::panicking::begin_panic_handler::{{closure}}::h8666b114c189d201
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:621:13
  15:     0x7ffff3963626 - std::sys_common::backtrace::__rust_end_short_backtrace::hbd795f102b6b1452
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7ffff3966352 - rust_begin_unwind
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:617:5
  17:     0x7ffff39c57c3 - core::panicking::panic_fmt::hce42cf6758165d04
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/panicking.rs:67:14
  18:     0x7ffff39ce41a - core::str::slice_error_fail_rt::h031fd711425c50d2
  19:     0x7ffff39ce227 - core::str::slice_error_fail::h30d668786860e6c6
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/str/mod.rs:87:9
  20:     0x55555591f445 - rustdoc[d3295c227ca37e54]::passes::lint::redundant_explicit_links::visit_item
  21:     0x5555559b84f5 - <rustdoc[d3295c227ca37e54]::passes::lint::Linter as rustdoc[d3295c227ca37e54]::visit::DocVisitor>::visit_item
  22:     0x5555559b85ea - <rustdoc[d3295c227ca37e54]::passes::lint::Linter as rustdoc[d3295c227ca37e54]::visit::DocVisitor>::visit_item
  23:     0x5555559b7f70 - rustdoc[d3295c227ca37e54]::passes::lint::run_lints
  24:     0x555555a6d2fe - <rustc_session[8b0e884d99892ff9]::session::Session>::time::<(rustdoc[d3295c227ca37e54]::clean::types::Crate, rustdoc[d3295c227ca37e54]::config::RenderOptions, rustdoc[d3295c227ca37e54]::formats::cache::Cache), rustdoc[d3295c227ca37e54]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
  25:     0x5555558f9492 - <rustc_middle[4f8dbc89c826d5e7]::ty::context::GlobalCtxt>::enter::<rustdoc[d3295c227ca37e54]::main_args::{closure#1}::{closure#0}::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>
  26:     0x555555a7190c - <scoped_tls[d6da6393853e293]::ScopedKey<rustc_span[98abfeae9902262c]::SessionGlobals>>::set::<rustc_interface[2bb5c4c25af7699b]::interface::run_compiler<core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>, rustdoc[d3295c227ca37e54]::main_args::{closure#1}>::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>
  27:     0x555555b81519 - std[9ddfa24fb45fdd5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2bb5c4c25af7699b]::util::run_in_thread_pool_with_globals<rustc_interface[2bb5c4c25af7699b]::interface::run_compiler<core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>, rustdoc[d3295c227ca37e54]::main_args::{closure#1}>::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>
  28:     0x555555ba4ef1 - <<std[9ddfa24fb45fdd5]::thread::Builder>::spawn_unchecked_<rustc_interface[2bb5c4c25af7699b]::util::run_in_thread_pool_with_globals<rustc_interface[2bb5c4c25af7699b]::interface::run_compiler<core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>, rustdoc[d3295c227ca37e54]::main_args::{closure#1}>::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[adbc28648fe68309]::result::Result<(), rustc_span[98abfeae9902262c]::ErrorGuaranteed>>::{closure#1} as core[adbc28648fe68309]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7ffff39711e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf9491799b6dcd8af
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/alloc/src/boxed.rs:2007:9
  30:     0x7ffff39711e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he56d203ba32460f1
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/alloc/src/boxed.rs:2007:9
  31:     0x7ffff39711e5 - std::sys::unix::thread::Thread::new::thread_start::h872e25e6c21f41ae
                               at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7ffff36ecff2 - start_thread
  33:     0x7ffff376fbfc - clone3
  34:                0x0 - <unknown>

error: 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-rustdoc&template=ice.md

note: rustc 1.73.0-beta.1 (680cdf816 2023-08-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `bumpalo`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name bumpalo /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bumpalo-3.13.0/src/lib.rs --cap-lints allow -o /home/user/git/doc_ice_115250/target/doc --cfg 'feature="default"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=131 -C metadata=dec1362c5469eb0e -L dependency=/home/user/git/doc_ice_115250/target/debug/deps --crate-version 3.13.0` (exit status: 101)
Backtrace

 Documenting bumpalo v3.13.0
thread 'rustc' panicked at src/librustdoc/passes/lint/redundant_explicit_links.rs:107:41:
byte index 1 is not a char boundary; it is inside '…' (bytes 0..3) of `…alloc_with(|| x)`
stack backtrace:
   0: rust_begin_unwind
             at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/std/src/panicking.rs:617:5
   1: core::panicking::panic_fmt
             at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/panicking.rs:67:14
   2: core::str::slice_error_fail_rt
   3: core::str::slice_error_fail
             at /rustc/680cdf8168a906b4ea80af673c64e4a16f77be57/library/core/src/str/mod.rs:87:9
   4: rustdoc::passes::lint::redundant_explicit_links::visit_item
   5: <rustdoc::passes::lint::Linter as rustdoc::visit::DocVisitor>::visit_item
   6: <rustdoc::passes::lint::Linter as rustdoc::visit::DocVisitor>::visit_item
   7: rustdoc::passes::lint::run_lints
   8: <rustc_session::session::Session>::time::<(rustdoc::clean::types::Crate, rustdoc::config::RenderOptions, rustdoc::formats::cache::Cache), rustdoc::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
   9: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustdoc::main_args::{closure#1}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  10: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: 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-rustdoc&template=ice.md

note: rustc 1.73.0-beta.1 (680cdf816 2023-08-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `bumpalo`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name bumpalo /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bumpalo-3.13.0/src/lib.rs --cap-lints allow -o /home/user/git/doc_ice_115250/target/doc --cfg 'feature="default"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=131 -C metadata=dec1362c5469eb0e -L dependency=/home/user/git/doc_ice_115250/target/debug/deps --crate-version 3.13.0` (exit status: 101)

@danjl1100 danjl1100 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 Aug 26, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 26, 2023
@danjl1100
Copy link
Author

Upon further searching, this appears to be broken in an earlier nightly (rustc 1.74.0-nightly (c469197b1 2023-08-22)) but fixed in a more recent nightly (rustc 1.74.0-nightly (734a0d0aa 2023-08-25)).

Is it part of the normal process to add fixes like this into beta before they hit stable?

@GuillaumeGomez
Copy link
Member

Normally yes. Is the bug present in beta?

@danjl1100
Copy link
Author

Yes, I saw this in rustc 1.73.0-beta.1 (680cdf816 2023-08-21)

@GuillaumeGomez
Copy link
Member

Ah the fix has already been nominated to beta.

@Nilstrieb Nilstrieb added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 4, 2023
@Nilstrieb
Copy link
Member

The backport has been merged.

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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants