Skip to content

rustdoc crashes on weird macro assertion failed: begin <= end', src/libcore/str.rs:1002 #16019

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

Closed
apoelstra opened this issue Jul 27, 2014 · 0 comments
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@apoelstra
Copy link
Contributor

I noticed this in the rust-crypto code base. Consider the following program temp.rs:

#![feature(macro_rules)]
macro_rules! define_struct(
 ($rounds:expr) => (
    struct Struct {
      sk: [u32, ..$rounds + 1]
    }
  )
)

define_struct!(2)

Running rustdoc temp.rs gets you

task '<unnamed>' failed at 'assertion failed: begin <= end', /home/apoelstra/dload/code/rust/src/libcore/str.rs:1002
stack backtrace:
   1:     0x7f75bff39fc0 - rt::backtrace::imp::write::h5e8bb7d7d4e816f7eVp
   2:     0x7f75bff3cfc0 - failure::on_fail::h97df37e59a66e1b5bgq
   3:     0x7f75c494a9a0 - unwind::begin_unwind_inner::h7ca997cbfa47d085lTd
   4:     0x7f75c494a5f0 - unwind::begin_unwind_fmt::h7cd358ab9a21219duQd
   5:     0x7f75c494a5a0 - rust_begin_unwind
   6:     0x7f75c4995bb0 - failure::begin_unwind::ha6e2bb86cd385c5crWj
   7:     0x7f75c0ad91f0 - str::_&'a str.StrSlice<'a>::slice::h5e51c1396a0001e6evh
   8:     0x7f75c0adbd80 - codemap::CodeMap::span_to_snippet::hc28fdd42f889b11aRkC
   9:     0x7f75c4f487c0 - clean::syntax..codemap..Span.ToSource::to_src::hbcbc3ed17f478af4k2g
  10:     0x7f75c4f39920 - clean::ast..Ty.Clean<Type>::clean::h2b85767de491c743wWe
  11:     0x7f75c4f63f20 - clean::ast..StructField.Clean<Item>::clean::hdc53298eafb6c10fkbf
  12:     0x7f75c4f641f0 - clean::Vec<T>.Clean<Vec<U>>::clean::h3601407636379359189
  13:     0x7f75c4f30120 - clean::doctree..Struct.Clean<Item>::clean::ha00405932417ad80ijf
  14:     0x7f75c4f29410 - clean::doctree..Module.Clean<Item>::clean::hafd601e9a5a4f5db1vb
  15:     0x7f75c4f27dc0 - clean::visit_ast..RustdocVisitor<'a>.Clean<Crate>::clean::h883b248e43fece75SHa
  16:     0x7f75c4f7a3d0 - core::run_core::h3a0e665b6465cf98rLh
  17:     0x7f75c5048150 - rust_input::closure.$x22closure$x22$LP$30020$RP$
  18:     0x7f75c503f790 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$29784$RP$
  19:     0x7f75c4cacb20 - task::spawn_opts::closure.$x22closure$x22$LP$8587$RP$
  20:     0x7f75c49ac990 - rust_try
  21:     0x7f75c4947910 - unwind::try::h5e208c1a32550db4qHd
  22:     0x7f75c4947630 - task::Task::run::h0316a0f15219b9f2gSc
  23:     0x7f75c4cac910 - task::spawn_opts::closure.$x22closure$x22$LP$8531$RP$
  24:     0x7f75c49499f0 - thread::thread_start::h85e2b2ae4067e775kfd
  25:       0x38d9807e70 - start_thread
  26:       0x38d90f4db9 - clone
  27:                0x0 - <unknown>
task '<main>' failed at 'called `Result::unwrap()` on an `Err` value: Box<core::any::Any:Send>', /home/apoelstra/dload/code/rust/src/libcore/result.rs:548
stack backtrace:
   1:     0x7f75bff39fc0 - rt::backtrace::imp::write::h5e8bb7d7d4e816f7eVp
   2:     0x7f75bff3cfc0 - failure::on_fail::h97df37e59a66e1b5bgq
   3:     0x7f75c494a9a0 - unwind::begin_unwind_inner::h7ca997cbfa47d085lTd
   4:     0x7f75c494a5f0 - unwind::begin_unwind_fmt::h7cd358ab9a21219duQd
   5:     0x7f75c494a5a0 - rust_begin_unwind
   6:     0x7f75c4995bb0 - failure::begin_unwind::ha6e2bb86cd385c5crWj
   7:     0x7f75c502ecd0 - rust_input::hd8f276d4bba8946aU9s
   8:     0x7f75c5023ef0 - main_args::h7efb7f1389094a38DKs
   9:     0x7f75c5023dd0 - main::h6062a3701b4ba015bFs
  10:     0x7f75c4cad250 - start::closure.$x22closure$x22$LP$8657$RP$
  11:     0x7f75c49ac990 - rust_try
  12:     0x7f75c4947910 - unwind::try::h5e208c1a32550db4qHd
  13:     0x7f75c4947630 - task::Task::run::h0316a0f15219b9f2gSc
  14:     0x7f75c4cacee0 - start::h29522b57e3b2e373ake
  15:     0x7f75c4cace50 - lang_start::hc4a60e172b398ff6uje
  16:       0x38d9021c70 - __libc_start_main
  17:           0x4006f0 - <unknown>
  18:                0x0 - <unknown>

A workaround is to put parens around $round + 1.

@apoelstra apoelstra changed the title rustdoc crashes on weird macro assertion failed: begin <= end', /home/apoelstra/dload/code/rust/src/libcore/str.rs:1002 rustdoc crashes on weird macro assertion failed: begin <= end', src/libcore/str.rs:1002 Jul 27, 2014
nerdrew added a commit to nerdrew/rust-crypto that referenced this issue Nov 17, 2014
@alexcrichton alexcrichton self-assigned this Apr 7, 2015
BlockBlazeDev added a commit to BlockBlazeDev/rust-crypto that referenced this issue Aug 8, 2024
cosmycoder added a commit to cosmycoder/rust-crypto that referenced this issue Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants