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

macro! compilation is broken #32609

Closed
alsam opened this issue Mar 30, 2016 · 3 comments
Closed

macro! compilation is broken #32609

alsam opened this issue Mar 30, 2016 · 3 comments

Comments

@alsam
Copy link

alsam commented Mar 30, 2016

Hello,
compiling the code

// stolen from here: https://github.com/docopt/docopt.rs

#![feature(plugin)]
#![plugin(docopt_macros)]

extern crate rustc_serialize;
extern crate docopt;

use docopt::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() {
    let args: Args = Args::docopt().decode().unwrap_or_else(|e| e.exit());
    println!("{:?}", args);
}

I got the following:

RUST_BACKTRACE=1 rustc docopt_macro_use_case.rs --crate-name naval_fate --crate-type bin -g --out-dir /home/asamoilo/work/github/rust-samples/target/debug --emit=dep-info,link -L dependency=/home/asamoilo/work/github/rust-samples/target/debug -L dependency=/home/asamoilo/work/github/rust-samples/target/debug/deps --extern docopt_macros=/home/asamoilo/work/github/rust-samples/target/debug/deps/libdocopt_macros-c73640b38aaffb8d.so --extern dft=/home/asamoilo/work/github/rust-samples/target/debug/deps/libdft-f4ce2babe14ba439.rlib --extern endianness=/home/asamoilo/work/github/rust-samples/target/debug/deps/libendianness-03fb7d6dfcaefa9d.rlib --extern docopt=/home/asamoilo/work/github/rust-samples/target/debug/deps/libdocopt-bf1b771f6864695e.rlib --extern argparse=/home/asamoilo/work/github/rust-samples/target/debug/deps/libargparse-b299699413f65723.rlib --extern rustc_serialize=/home/asamoilo/work/github/rust-samples/target/debug/deps/librustc_serialize-e1b49f9d5f55eb83.rlib --extern integration=/home/asamoilo/work/github/rust-samples/target/debug/deps/libintegration-177fefb4396d4fcd.rlib --extern numeric=/home/asamoilo/work/github/rust-samples/target/debug/deps/libnumeric-86fe9c7e7012a01e.rlib --extern special_fun=/home/asamoilo/work/github/rust-samples/target/debug/deps/libspecial_fun-d51bb029c8a5ee5d.rlib --extern byteorder=/home/asamoilo/work/github/rust-samples/target/debug/deps/libbyteorder-8ad3fd7ac7478b9a.rlib --extern roots=/home/asamoilo/work/github/rust-samples/target/debug/deps/libroots-0fba8f516aedf92c.rlib --extern indoc=/home/asamoilo/work/github/rust-samples/target/debug/deps/libindoc-2ba8995adfb67597.so --extern arrayfire=/home/asamoilo/work/github/rust-samples/target/debug/deps/libarrayfire-28a6376b56875e96.rlib --extern num=/home/asamoilo/work/github/rust-samples/target/debug/deps/libnum-a2e6e61627ca7fe5.rlib -L /home/asamoilo/work/github/rust-samples/target/debug/build/openblas-provider-1395a30c451777af/out/opt/OpenBLAS/lib -L /home/asamoilo/work/github/rust-samples/target/debug/build/hdf5-sys-be6255808ddb57e7/out/install/lib -L native=/home/asamoilo/work/github/rust-samples/target/debug/build/special-fun-d22d3ab3b7c86bd7/out -L native=/home/asamoilo/work/arrayfire-3/lib
docopt_macro_use_case.rs:11:28: 28:2 error: internal compiler error: attempted to bump the parser past EOF (may be stuck in a loop)
docopt_macro_use_case.rs:11 docopt!(Args derive Debug, "
docopt_macro_use_case.rs:12 Naval Fate.
docopt_macro_use_case.rs:13
docopt_macro_use_case.rs:14 Usage:
docopt_macro_use_case.rs:15   naval_fate.py ship new <name>...
docopt_macro_use_case.rs:16   naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
                            ...
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<Any>', src/libsyntax/errors/mod.rs:530
stack backtrace:
   1:     0x7f90c1fb4910 - std::sys::backtrace::tracing::imp::write::h3152d690c5b90b0c
   2:     0x7f90c1fc1fdb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hb638acea7c29901b
   3:     0x7f90c1fc1b77 - std::panicking::default_hook::h508c3dab3df347d6
   4:     0x7f90c1f8590f - std::sys_common::unwind::begin_unwind_inner::h5cd31b1580026517
   5:     0x7f90bdc57b57 - std::sys_common::unwind::begin_unwind::h3c4f13a755ad0bbe
   6:     0x7f90bdca4d27 - syntax::errors::Handler::span_bug::hdcb0e10c51b41480
   7:     0x7f90bdd245cf - syntax::parse::parser::Parser::bug::he7b4111e59d952e8
   8:     0x7f90bdd209de - syntax::parse::parser::Parser::bump::he523a889a3b45d37
   9:     0x7f90b94acaa1 - syntax::parse::parser::Parser::parse_seq_to_end::h8ca401faebe38a0b
                        at src/libsyntax/parse/parser.rs:888
  10:     0x7f90b9449dd0 - docopt_macros::MacParser::parse::h44f944b05c21e77a
                        at /home/asamoilo/.cargo/registry/src/git.luolix.top-88ac128001ac3a9a/docopt_macros-0.6.81/src/macro.rs:178
  11:     0x7f90b94492c9 - docopt_macros::expand::h1e2acea4b9daddc9
                        at /home/asamoilo/.cargo/registry/src/git.luolix.top-88ac128001ac3a9a/docopt_macros-0.6.81/src/macro.rs:41
  12:     0x7f90c22e3668 - _<F as syntax..ext..base..TTMacroExpander>::expand::he655593cd83ac43e
  13:     0x7f90bdef8495 - syntax::ext::expand::expand_item_mac::hb9fd5452efe40ae2
  14:     0x7f90bdee63e1 - syntax::ext::expand::expand_annotatable::h97f0f2de9049603e
  15:     0x7f90bdee36a8 - syntax::ext::expand::expand_item::h2f2d11398d59e88e
  16:     0x7f90bdef1a9e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::ha0c7e351e3f5aec8
  17:     0x7f90bdef16c3 - syntax::fold::noop_fold_mod::hd8dd04756addcf17
  18:     0x7f90bdeeab5e - syntax::ext::expand::expand_item_kind::hf32f931f8054890c
  19:     0x7f90bdf26c3e - syntax::fold::noop_fold_item_simple::hd96dc1e0c8e0f12b
  20:     0x7f90bdf267a0 - syntax::fold::noop_fold_item::hcdb2ebce0b2581f7
  21:     0x7f90bdee7c50 - syntax::ext::expand::expand_annotatable::h97f0f2de9049603e
  22:     0x7f90bdee36a8 - syntax::ext::expand::expand_item::h2f2d11398d59e88e
  23:     0x7f90bdef1d8e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::ha0c7e351e3f5aec8
  24:     0x7f90bdf32efb - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_crate::hd1955ef311b10dc7
 25:     0x7f90bdf343ba - syntax::ext::expand::expand_crate::h178a95a0ec3cd12a
  26:     0x7f90c23bc9b1 - rustc_driver::driver::phase_2_configure_and_expand::_$u7b$$u7b$closure$u7d$$u7d$::h7eccc7aae229e943
  27:     0x7f90c2368127 - rustc_driver::driver::phase_2_configure_and_expand::he16002fe35b1b913
  28:     0x7f90c234c08a - rustc_driver::driver::compile_input::h8aae9cff2c941087
  29:     0x7f90c233bae4 - rustc_driver::run_compiler::h19dee01e74add0e2
  30:     0x7f90c2339041 - std::sys_common::unwind::try::try_fn::hfc6358ae35d5adc0
  31:     0x7f90c1fb1f6b - __rust_try
  32:     0x7f90c1fb1efd - std::sys_common::unwind::inner_try::h0adf4a3bf383b17e
  33:     0x7f90c233988a - _<F as alloc..boxed..FnBox<A>>::call_box::h9115446e39330382
  34:     0x7f90c1fc01a4 - std::sys::thread::Thread::new::thread_start::h8dfc0bc1e9d1f51d
  35:     0x7f90bd901850 - start_thread
  36:     0x7f90c1c2990c - clone
  37:                0x0 - <unknown>

Additional information:

rustc --version
rustc 1.9.0-dev (a48c9a11a 2016-03-29)
uname -a
Linux ies-d2s-dev-05.ies.mentorg.com 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

Thanks!

@pmarcelll
Copy link
Contributor

This is caused by #32479, docopt triggers the ICE in the new code, but a fix is already on the way: docopt/docopt.rs#171.
You just have to update docopt when this PR is merged.

@alsam
Copy link
Author

alsam commented Mar 30, 2016

Great, thanks @pmarcelll !

@alsam
Copy link
Author

alsam commented Apr 2, 2016

Closing the issue - the patch has landed.

@alsam alsam closed this as completed Apr 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants