Skip to content

ICE when items are defined inside fields #29276

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

Closed
petrochenkov opened this issue Oct 24, 2015 · 3 comments
Closed

ICE when items are defined inside fields #29276

petrochenkov opened this issue Oct 24, 2015 · 3 comments
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@petrochenkov
Copy link
Contributor

Code:

struct S([u8; {struct Z; 0 }]);

fn main() {}

Reproduces on both stable and nightly.

Meta:

$ rustc --version --verbose
rustc 1.3.0 (9a92aaf19 2015-09-15)
binary: rustc
commit-hash: 9a92aaf19a64603b02b4130fe52958cc12488900
commit-date: 2015-09-15
host: x86_64-pc-windows-gnu
release: 1.3.0

$ RUST_BACKTRACE=1 rustc test.rs
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
thread 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 11 }Z in tcx.item_variance_map', ../src/librustc\middle\ty.rs:5152

stack backtrace:
   1:         0x6c6bbc58 - sys::backtrace::write::h9192fb96d06a04279Hs
   2:         0x6c6c582d - rt::unwind::register::hf2debafc128a8bbcxWw
   3:         0x6c685a6f - rt::unwind::begin_unwind_inner::hcb96b94c1db5c440GTw
   4:         0x6c6863f6 - rt::unwind::begin_unwind_fmt::h28f0332c3e8f2752MSw
   5:         0x70f40b75 - middle::ty::ctxt<'tcx>::item_variances::ha5d9a4cd6cc6326f2tb
   6:           0xca4f1c - check::FnCtxt<'a, 'tcx>::register_builtin_bound::h943db64912a2171cN2o
   7:           0xca27b2 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::new::hd82ea0334ef8c589c5j
   8:           0xca976e - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::hc1d90458249ea5fdiCk
   9:           0xca9588 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::hc1d90458249ea5fdiCk
  10:           0xca8abb - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::hc1d90458249ea5fdiCk
  11:           0xcc6fd9 - check::check_item_types::h3739f0f18758ac32ewn
  12:           0xd83344 - check_crate::h8ef65f4638074ba9laD
  13:         0x64b2651b - driver::assign_node_ids_and_map::hae564fdeb2ac85907Da
  14:         0x64b24c34 - driver::assign_node_ids_and_map::hae564fdeb2ac85907Da
  15:         0x64b1f3b7 - driver::assign_node_ids_and_map::hae564fdeb2ac85907Da
  16:         0x64b02766 - driver::compile_input::h23ee8d2f30f41c3bTba
  17:         0x64beb53c - run_compiler::h13fbc9ea0e4d6074A7b
  18:         0x64be92b7 - run::h6cfcc1625a0298d9g7b
  19:         0x64be8c59 - run::h6cfcc1625a0298d9g7b
  20:         0x6c6af014 - rt::unwind::try::inner_try::hac50b220aa363696zPw
  21:         0x64be8e27 - run::h6cfcc1625a0298d9g7b
  22:         0x6c6c344e - sys::process::Command::cwd::h809ce520f020ef4eyzv
  23:     0x7ffa1fa313d2 - BaseThreadInitThunk
@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 24, 2015
@steveklabnik
Copy link
Member

This no longer ICEs as of rustc 1.6.0-nightly (9303055f3 2015-11-19)

@steveklabnik steveklabnik added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Nov 19, 2015
@apasel422
Copy link
Contributor

What is the correct behavior here? It's true that it no longer ICEs, but this shouldn't compile, right?

@petrochenkov
Copy link
Contributor Author

It's true that it no longer ICEs, but this shouldn't compile, right?

Why? Items are currently allowed in all blocks. This is a very simple rule to teach and implement.
Separation between "good" blocks and "bad" blocks would be somewhat artificial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants