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

ICE during derive expansion on 2017-03-19 nightly #40663

Closed
SergioBenitez opened this issue Mar 20, 2017 · 2 comments
Closed

ICE during derive expansion on 2017-03-19 nightly #40663

SergioBenitez opened this issue Mar 20, 2017 · 2 comments
Labels
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.

Comments

@SergioBenitez
Copy link
Contributor

On the latest nightly, a structure which derives traits from serde, diesel, and rocket, triggers an ICE. This is the structure's declaration:

#[table_name = "tasks"]
#[derive(Serialize, Queryable, Insertable, FromForm)]
pub struct Task { ... contents irrelevant ... }

Here's the ICE:

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 2 but the index is 2', src/libcollections/vec.rs:1426
stack backtrace:
   0:        0x11102e023 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h7b906ec435ded35c
   1:        0x11103a9f4 - std::panicking::default_hook::{{closure}}::h44d92332f38028b9
   2:        0x11103a58d - std::panicking::default_hook::ha8486ead32221b33
   3:        0x11103d157 - std::panicking::rust_panic_with_hook::hdbc3bba6a9dc0bb9
   4:        0x11103cff4 - std::panicking::begin_panic::ha249c774b9bf96e1
   5:        0x11103cf62 - std::panicking::begin_panic_fmt::ha197daaf02a649ab
   6:        0x11103cec7 - rust_begin_unwind
   7:        0x111078bd0 - core::panicking::panic_fmt::h7414cb5ce71ea361
   8:        0x111078b48 - core::panicking::panic_bounds_check::he665f717df667fd0
   9:        0x10d5e279c - rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver<'a>>::find_legacy_attr_invoc::h12025a97e3907024
  10:        0x110a9124d - <syntax::ext::expand::InvocationCollector<'a, 'b> as syntax::fold::Folder>::fold_item::hbbc809bd72ded440
  11:        0x11096fb7d - syntax::fold::noop_fold_mod::h0f51c54f5e33b230
  12:        0x11095981f - syntax::fold::noop_fold_item_kind::h567f7cec8486a234
  13:        0x1109759c9 - syntax::fold::noop_fold_item_simple::h401baac7dfe144e6
  14:        0x110a91f11 - <syntax::ext::expand::InvocationCollector<'a, 'b> as syntax::fold::Folder>::fold_item::hbbc809bd72ded440
  15:        0x11096fb7d - syntax::fold::noop_fold_mod::h0f51c54f5e33b230
  16:        0x11095981f - syntax::fold::noop_fold_item_kind::h567f7cec8486a234
  17:        0x1109759c9 - syntax::fold::noop_fold_item_simple::h401baac7dfe144e6
  18:        0x110a9205f - <syntax::ext::expand::InvocationCollector<'a, 'b> as syntax::fold::Folder>::fold_item::hbbc809bd72ded440
  19:        0x1108c9be1 - <core::iter::FlatMap<I, U, F> as core::iter::iterator::Iterator>::next::h080896ae28cef138
  20:        0x110a7d415 - syntax::ext::expand::MacroExpander::collect_invocations::hb41ec1de218eded1
  21:        0x110a7963f - syntax::ext::expand::MacroExpander::expand::hf7d89690970df208
  22:        0x110a79066 - syntax::ext::expand::MacroExpander::expand_crate::h9f11367fa410f86f
  23:        0x10c72a3e3 - rustc_driver::driver::phase_2_configure_and_expand::{{closure}}::h83f82b5438ae7fdd
  24:        0x10c724524 - rustc_driver::driver::phase_2_configure_and_expand::h7993466b5ba9f43d
  25:        0x10c71ddc4 - rustc_driver::driver::compile_input::h4a3867b4383a9600
  26:        0x10c76203c - rustc_driver::run_compiler::hb11017c6b45be0d6
  27:        0x10c6977c8 - std::panicking::try::do_call::hc2d47b7090d8b7b0
  28:        0x11103ff3a - __rust_maybe_catch_panic
  29:        0x10c6b0a23 - <F as alloc::boxed::FnBox<A>>::call_box::hddb88924f2a81c7b
  30:        0x111039a44 - std::sys::imp::thread::Thread::new::thread_start::h4008e1859fbd98b8
  31:     0x7fff83b0799c - _pthread_body
  32:     0x7fff83b07919 - _pthread_start

The ICE only occurs when the right combination of derives is used. For instance, removing any of Serialize, Queryable, Insertable, or FromForm from the derive list does not result in a panic.

The panic appears to be occurring during expansion (@jseyfried, @nrc).

@SergioBenitez
Copy link
Contributor Author

Likely related to #40346.

@jseyfried
Copy link
Contributor

Fixed in #40664.

@steveklabnik steveklabnik added 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 Mar 20, 2017
bors added a commit that referenced this issue Mar 21, 2017
macros: fix bug in legacy custom derive processing

Fixes #40663.
r? @nrc
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants