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

rustc panic with docopt_macros #28089

Closed
trombonehero opened this issue Aug 29, 2015 · 8 comments
Closed

rustc panic with docopt_macros #28089

trombonehero opened this issue Aug 29, 2015 · 8 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@trombonehero
Copy link

Compiling the following main.rs with rustc d877e65 (driven by rust-lang/cargo@1b902d4):

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

docopt!(Args, "
Usage: foo (--help | --version)

Options:
    -h, --help     Show this message
    --version      Show the version of foo
");

I get the following error and backtrace:

       Fresh rustc-serialize v0.3.16
       Fresh libc v0.1.10
       Fresh byteorder v0.3.11
       Fresh strsim v0.3.0
       Fresh regex-syntax v0.2.1
       Fresh pcap v0.3.2
       Fresh memchr v0.1.5
       Fresh aho-corasick v0.3.0
       Fresh regex v0.1.41
       Fresh docopt v0.6.70
   Compiling rshark v0.0.1 (file:///Volumes/Dev/rust/rusty-shark)
     Running `rustc src/main.rs --crate-name rshark --crate-type bin -g --out-dir /Volumes/Dev/rust/rusty-shark/target/debug --emit=dep-info,link -L dependency=/Volumes/Dev/rust/rusty-shark/target/debug -L dependency=/Volumes/Dev/rust/rusty-shark/target/debug/deps --extern rustc_serialize=/Volumes/Dev/rust/rusty-shark/target/debug/deps/librustc_serialize-7ff5bfc027146194.rlib --extern byteorder=/Volumes/Dev/rust/rusty-shark/target/debug/deps/libbyteorder-4fce7f4e6a3a7971.rlib --extern docopt_macros=/Volumes/Dev/rust/rusty-shark/target/debug/deps/libdocopt_macros-a6de226da2d2dbee.dylib --extern docopt=/Volumes/Dev/rust/rusty-shark/target/debug/deps/libdocopt-faaff1fb4e49b8d3.rlib --extern pcap=/Volumes/Dev/rust/rusty-shark/target/debug/deps/libpcap-a15489e5f8e0ae99.rlib --extern rshark=/Volumes/Dev/rust/rusty-shark/target/debug/librshark.rlib`
       Fresh docopt_macros v0.6.70
thread 'rustc' panicked at 'index out of bounds: the len is 60 but the index is 65', src/libcollections/vec.rs:1261

stack backtrace:
   1:        0x10892ad95 - sys::backtrace::write::hb66fe514ff57da79Yws
   2:        0x108933e9e - panicking::on_panic::h1391145d0b989950GXw
   3:        0x1088ed882 - rt::unwind::begin_unwind_inner::hb494f9df36a862c1RFw
   4:        0x1088ee75c - rt::unwind::begin_unwind_fmt::h52e6b4971e042d46XEw
   5:        0x108933a1c - rust_begin_unwind
   6:        0x1089853f5 - panicking::panic_fmt::hd75b6cee85f3afe4SgC
   7:        0x10897fb35 - panicking::panic_bounds_check::h75be7bf05a80539eYfC
   8:        0x10e1450f5 - parse::token::InternedString::new_from_name::h8111e5682fc45ad3FkT
   9:        0x10e20bf18 - parse::parser::Parser<'a>::lit_from_token::h0d07f04eeabf23bchNG
  10:        0x10e210757 - parse::parser::Parser<'a>::parse_lit::haa0eebf06d59b0d9lRG
  11:        0x10e2166f0 - parse::parser::Parser<'a>::parse_bottom_expr::h7495fdc246becf10smH
  12:        0x10e21c172 - parse::parser::Parser<'a>::parse_dot_or_call_expr::hf83bae54e6ee28e41PH
  13:        0x10e220253 - parse::parser::Parser<'a>::parse_prefix_expr::h6dcba969e9fcdfa6ejI
  14:        0x10e2210e2 - parse::parser::Parser<'a>::parse_binops::ha6fcf1d22eba030e5tI
  15:        0x10e221b0b - parse::parser::Parser<'a>::parse_assign_expr::h1237d11d5bcb411eXzI
  16:        0x10e1ef991 - parse::parser::Parser<'a>::parse_expr::hf4118a56a6da097cc6E
  17:        0x10d2b05df - MacParser<'a, 'b>::parse_str::hdb359ba5b83664ee8ra
  18:        0x10d232aa7 - MacParser<'a, 'b>::parse::h134ebf17f8af49ccuoa
  19:        0x10d2325c2 - expand::hb4b7305ba726be863aa
  20:        0x10dbc3d0e - ext::base::F.TTMacroExpander::expand::h15442948462285585430
  21:        0x10674e06a - ext::expand::expand_item_mac::h70316ca4f5b12b7dYRb
  22:        0x10673d820 - ext::expand::expand_annotatable::h670bc4d68c7340e44lc
  23:        0x106739e0d - ext::expand::expand_item::h1d57b59c88ed776dWOb
  24:        0x1067463eb - fold::noop_fold_mod::closure.66426
  25:        0x10674606c - iter::FlatMap<I, U, F>.Iterator::next::h7787021719063519280
  26:        0x106745ab5 - vec::Vec<T>.FromIterator<T>::from_iter::h8769822404114346174
  27:        0x106745845 - fold::Folder::fold_mod::h12688539743151791588
  28:        0x106740ad8 - ext::expand::expand_item_underscore::ha6887def1d44464dxPb
  29:        0x106793772 - fold::noop_fold_item_simple::h12171689993025331003
  30:        0x1067932f6 - fold::noop_fold_item::h236170770538799404
  31:        0x10673ec75 - ext::expand::expand_annotatable::h670bc4d68c7340e44lc
  32:        0x106739e0d - ext::expand::expand_item::h1d57b59c88ed776dWOb
  33:        0x10679ad8f - ext::expand::expand_crate::h1cdd399411e3b25bUNc
  34:        0x105198815 - driver::phase_2_configure_and_expand::closure.22401
  35:        0x10514b5e3 - driver::phase_2_configure_and_expand::h2b5eb3aac7e23d4cita
  36:        0x10513c0c5 - driver::compile_input::h6ff6de4909e0ced5Tba
  37:        0x105220210 - run_compiler::h855428a6f31812ebA7b
  38:        0x10521dca0 - boxed::F.FnBox<A>::call_box::h1402838733596026107
  39:        0x10521d517 - rt::unwind::try::try_fn::h10520533051806862779
  40:        0x10893394f - __rust_try_inner
  41:        0x10893398a - __rust_try
  42:        0x10891d305 - rt::unwind::try::inner_try::hfce8c2a882970c4aKBw
  43:        0x10521d759 - boxed::F.FnBox<A>::call_box::h4757993596228899159
  44:        0x10893292d - sys::thread::Thread::new::thread_start::h477ee10709502668l0v
  45:     0x7fff94b9f267 - _pthread_body
  46:     0x7fff94b9f1e4 - _pthread_start

This might be a duplicate of one of the "me too" reports on #24819, but I don't think it's a duplicate of originally-reported issue.

@trombonehero
Copy link
Author

Possibly duplicate of #27848?

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 3, 2015
@nerdrew
Copy link

nerdrew commented Sep 22, 2015

It feels like plugins might be broken on the mac nightly. doctopt! and regex! both panic.

% uname -a
Darwin hog.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
% rustc --version
rustc 1.5.0-nightly (f93ab64d4 2015-09-21)

@nerdrew
Copy link

nerdrew commented Sep 22, 2015

Possible duplicate of #27271

@bltavares
Copy link
Contributor

I had to change the code to compile with the latest version of docopt.
I was not able to reproduce it anymore.

Here is the code.

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

extern crate rustc_serialize;
extern crate docopt;

use docopt::Docopt;

docopt!(Args derive Debug, "
Usage: foo (--help | --version)

Options:
    -h, --help     Show this message
    --version      Show the version of foo
");

fn main() {
    let args: Args = Args::docopt().decode().unwrap_or_else(|e| e.exit());
    println!("{:?}", args);
}
[package]
name = "28089"
version = "0.1.0"
authors = [""]

[dependencies]
rustc-serialize = '0.3.16'
docopt = '0.6.75'
docopt_macros = '0.6.75'
cargo run -- --help
     Running `target/debug/28089 --help`
Usage: foo (--help | --version)

Options:
    -h, --help     Show this message
    --version      Show the version of foo
cargo version
cargo 0.7.0-nightly (f191c24 2015-11-12)
rustc --version
rustc 1.6.0-nightly (cc3094872 2015-11-11)
uname -a
Darwin sparta 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64

@nerdrew
Copy link

nerdrew commented Dec 15, 2015

Hmmmm. Ideas why this would still ICE for me?

% cargo run
   Compiling rustc-serialize v0.3.16
   Compiling regex-syntax v0.2.2
   Compiling libc v0.2.2
   Compiling strsim v0.3.0
   Compiling memchr v0.1.7
   Compiling aho-corasick v0.4.0
   Compiling regex v0.1.43
   Compiling docopt v0.6.78
   Compiling docopt_macros v0.6.78
   Compiling 28089 v0.1.0 (file:///Users/lazarus/dev/tmp/bad-rust-plugin-2)
error: internal compiler error: unexpected panic
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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 60 but the index is 67', ../src/libcollections/vec.rs:1132

Could not compile `28089`.

To learn more, run the command again with --verbose.
% cargo version
cargo 0.8.0-nightly (dd32072 2015-12-12)
% rustc --version
rustc 1.7.0-nightly (110df043b 2015-12-13)
% uname -a
Darwin hog.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep  1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64

I'm using the latest rust nightly binary from https://static.rust-lang.org/dist/rust-nightly-x86_64-apple-darwin.tar.gz (this homebrew formula: https://github.com/nerdrew/homebrew-tap/blob/master/rust-nightly.rb)

@nerdrew
Copy link

nerdrew commented Dec 15, 2015

Ok. Using the rust-nightly homebrew formula above, it ICEs. If I install rust using rustup.sh, then it works. Seems macros don't like the different prefix / the symlinks.

@dtwood
Copy link

dtwood commented Sep 6, 2016

This is probably now working - the latest version of that homebrew formula, with the latest roman numeral example plugin works, but I can't close this issue

@Mark-Simulacrum
Copy link
Member

Closing per the above comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants