Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

docopt! macro tries to read past EOF and crashes rustc #173

Closed
Janno opened this issue Apr 1, 2016 · 3 comments
Closed

docopt! macro tries to read past EOF and crashes rustc #173

Janno opened this issue Apr 1, 2016 · 3 comments

Comments

@Janno
Copy link

Janno commented Apr 1, 2016

I copied the standard "naval fate" macro example from the readme but it won't compile. The actual usage string doesn't seem to matter, though. Even with different example the error is still the same.

My code:

#![feature(plugin)]
#![plugin(docopt_macros)]
extern crate rustc_serialize;
extern crate docopt;

docopt!(Args derive Debug, "
Naval Fate.

Usage:
  naval_fate.py ship new <name>...
  naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
  naval_fate.py ship shoot <x> <y>
  naval_fate.py mine (set|remove) <x> <y> [--moored | --drifting]
  naval_fate.py (-h | --help)
  naval_fate.py --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.
");
fn main() {
}

My compiler version:

$ rustc --version
rustc 1.9.0-nightly (e1195c24b 2016-03-31)

rustc output with RUST_TRACEBACK=1

Compiling [myproject] v0.1.0 (file:///home/janno/src/[myproject])
src/main.rs:6:28: 23:2 error: internal compiler error: attempted to bump the parser past EOF (may be stuck in a loop)
src/main.rs: 6 docopt!(Args derive Debug, "
src/main.rs: 7 Naval Fate.
src/main.rs: 8
src/main.rs: 9 Usage:
src/main.rs:10 naval_fate.py ship new ...
src/main.rs:11 naval_fate.py ship move [--speed=]
...
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
thread 'rustc' panicked at 'Box', ../src/libsyntax/errors/mod.rs:536
stack backtrace:
1: 0x7f5f9e427260 - std::sys::backtrace::tracing::imp::write::hc787ac7b725fc252
2: 0x7f5f9e43493b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hff309ab1d83ffd90
3: 0x7f5f9e4344d7 - std::panicking::default_hook::h08ad3bb09872855b
4: 0x7f5f9e3f824f - std::sys_common::unwind::begin_unwind_inner::hfa66df7b3e69707e
5: 0x7f5f96aabc97 - std::sys_common::unwind::begin_unwind::hd6dd7aba1b4f2a0b
6: 0x7f5f96af8e75 - syntax::errors::Handler::span_bug::hd44cac9f78a8d57b
7: 0x7f5f96b7853f - syntax::parse::parser::Parser::bug::he4bf037f6c7e6454
8: 0x7f5f96b7476e - syntax::parse::parser::Parser::bump::he9d9c63a73c19735
9: 0x7f5f918a4281 - syntax::parse::parser::Parser::parse_seq_to_end::h8ca401faebe38a0b
at ../src/libsyntax/parse/parser.rs:891
10: 0x7f5f918415b0 - docopt_macros::MacParser::parse::h44f944b05c21e77a
at /home/janno/.multirust/toolchains/nightly/cargo/registry/src/git.luolix.top-88ac128001ac3a9a/docopt_macros-0.6.81/src/macro.rs:178
11: 0x7f5f91840aa9 - docopt_macros::expand::h1e2acea4b9daddc9
at /home/janno/.multirust/toolchains/nightly/cargo/registry/src/git.luolix.top-88ac128001ac3a9a/docopt_macros-0.6.81/src/macro.rs:41
12: 0x7f5f9dd9d968 - _::expand::he655593cd83ac43e
13: 0x7f5f96d4d118 - syntax::ext::expand::expand_item_mac::h4cbcc9da1cdde24f
14: 0x7f5f96d3b071 - syntax::ext::expand::expand_annotatable::hd0129691b0f8b93d
15: 0x7f5f96d38338 - syntax::ext::expand::expand_item::h56ee539b7cde8407
16: 0x7f5f96d4674e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::hdce1cac1401f2259
17: 0x7f5f96d46373 - syntax::fold::noop_fold_mod::h0679922c15e93846
18: 0x7f5f96d3f7d1 - syntax::ext::expand::expand_item_kind::ha057f5cdbbf45776
19: 0x7f5f96d7bc3e - syntax::fold::noop_fold_item_simple::hd97c1ad63a18a2c4
20: 0x7f5f96d7b7a0 - syntax::fold::noop_fold_item::h75db078a454ca3ad
21: 0x7f5f96d3c8e0 - syntax::ext::expand::expand_annotatable::hd0129691b0f8b93d
22: 0x7f5f96d38338 - syntax::ext::expand::expand_item::h56ee539b7cde8407
23: 0x7f5f96d46a3e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::hdce1cac1401f2259
24: 0x7f5f96d87b4b - <ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_crate::he184cdd28c91132e
25: 0x7f5f96d8900a - syntax::ext::expand::expand_crate::h3b7ba1989fc298b8
26: 0x7f5f9e9b3561 - rustc_driver::driver::phase_2_configure_and_expand::
$u7b$$u7b$closure$u7d$$u7d$::h1900769185937e61
27: 0x7f5f9e95ecd7 - rustc_driver::driver::phase_2_configure_and_expand::hc54328f6c9fdc71e
28: 0x7f5f9e942c0a - rustc_driver::driver::compile_input::h4de0250909a780b6
29: 0x7f5f9e9325d4 - rustc_driver::run_compiler::hb9ea120b81672dbd
30: 0x7f5f9e92fb31 - std::sys_common::unwind::try::try_fn::h10e40fd87dec6cc0
31: 0x7f5f9e4248bb - __rust_try
32: 0x7f5f9e42484d - std::sys_common::unwind::inner_try::h010cc5014fd950a2
33: 0x7f5f9e93037a - _<F as std..boxed..FnBox>::call_box::hbe6d6868b645ad75
34: 0x7f5f9e432b04 - std::sys::thread::Thread::new::thread_start::h003cd23941cb846b
35: 0x7f5f96357453 - start_thread
36: 0x7f5f9e08eedc - clone
37: 0x0 -

@BurntSushi
Copy link
Member

Dupe of #171 (hopefully I can get that PR merged soon)

@BurntSushi
Copy link
Member

Should be fixed in docopt_macros 0.6.82.

@Janno
Copy link
Author

Janno commented Apr 1, 2016

Indeed, it is. Amazing! Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants