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

'assertion failed: fields.len() > 0' ICE with struct variants #19003

Closed
tomjakubowski opened this issue Nov 16, 2014 · 1 comment · Fixed by #19018
Closed

'assertion failed: fields.len() > 0' ICE with struct variants #19003

tomjakubowski opened this issue Nov 16, 2014 · 1 comment · Fixed by #19018

Comments

@tomjakubowski
Copy link
Contributor

Simple reproduction:

#![feature(struct_variant)]

enum Foo {
    Bar {}
}

fn main() {}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: fields.len() > 0', /build/rust-git/src/rust/src/librustc/middle/ty.rs:4273

stack backtrace:
   1:     0x7fc1d4523f90 - rt::backtrace::imp::write::h599f1affd1b0bc63Bgt
   2:     0x7fc1d4527010 - <unknown>
   3:     0x7fc1d4cdb5f0 - unwind::begin_unwind_inner::h9a24fa62b68e1061E9c
   4:     0x7fc1d50886b0 - <unknown>
   5:     0x7fc1d54bfcd0 - middle::ty::VariantInfo::from_ast_variant::hfdc74922dfb784f6HCK
   6:     0x7fc1d57fef20 - middle::typeck::variance::ConstraintContext<'a, 'tcx>.Visitor<'v>::visit_item::h21525de41ade7650gun
   7:     0x7fc1d57f9d80 - middle::typeck::variance::infer_variance::h403b90f07402dc1cM6m
   8:     0x7fc1d50a36c0 - <unknown>
   9:     0x7fc1d5804680 - middle::typeck::check_crate::h4c6a3e5eabf06e46lrp
  10:     0x7fc1d5866610 - driver::driver::phase_3_run_analysis_passes::ha2a07c2b2bcd993dM9B
  11:     0x7fc1d5861b00 - driver::driver::compile_input::h62b35130395852dcxQB
  12:     0x7fc1d58e9390 - <unknown>
  13:     0x7fc1d58e9280 - <unknown>
  14:     0x7fc1d50bcbf0 - <unknown>
  15:     0x7fc1d50bc9e0 - <unknown>
  16:     0x7fc1d6114a10 - <unknown>
  17:     0x7fc1d4d28820 - <unknown>
  18:     0x7fc1d4d28810 - rust_try
  19:     0x7fc1d4cd8f70 - unwind::try::ha5be98cf90518e14mYc
  20:     0x7fc1d4cd8e00 - task::Task::run::h2157d702c714dd0du4b
  21:     0x7fc1d6114750 - <unknown>
  22:     0x7fc1d4cda610 - <unknown>
  23:     0x7fc1cfedc250 - start_thread
  24:     0x7fc1d49b53b9 - clone
  25:                0x0 - <unknown>

Version is rustc 0.13.0-dev (7e43f419c 2014-11-15 13:22:24 +0000)

@tomjakubowski
Copy link
Contributor Author

I'll submit a fix shortly. I guess it's an open question whether that should be a nullary variant or an error, related to the question about whether struct Foo {} is acceptable.

tomjakubowski added a commit to tomjakubowski/rust that referenced this issue Nov 17, 2014
Make struct variant syntax more consistent with struct syntax and fix an
assert in middle::typeck.

Fix rust-lang#19003
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

Successfully merging a pull request may close this issue.

1 participant