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: Unexpected tail in unsized_info_ty #36975

Closed
aka-demik opened this issue Oct 5, 2016 · 1 comment
Closed

ICE: Unexpected tail in unsized_info_ty #36975

aka-demik opened this issue Oct 5, 2016 · 1 comment

Comments

@aka-demik
Copy link

ICE when define unused and unsized enum in unused struct. Tested on 1.12, Beta, Nightly.

Code (playground):

#![allow(dead_code)]
#[derive(Debug)]
enum E { V1([u8]) }
struct S { e: E }
fn main() {}

Output:

error: internal compiler error: ../src/librustc_trans\type_of.rs:180: Unexpected tail in unsized_info_ty: E for ty=E 

Meta

rustc --version --verbose:

rustc 1.12.0 (3191fbae9 2016-09-23)
binary: rustc
commit-hash: 3191fbae9da539442351f883bdabcad0d72efcb6
commit-date: 2016-09-23
host: i686-pc-windows-gnu
release: 1.12.0 

Backtrace from play.rust-lang.org (on windows backtrace is useless):

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:634
stack backtrace:
   1:     0x7fcf698dfd99 - std::sys::backtrace::tracing::imp::write::h00e948915d1e4c72
   2:     0x7fcf698f05dc - std::panicking::default_hook::_{{closure}}::h7b8a142818383fb8
   3:     0x7fcf698ee9d4 - std::panicking::default_hook::h41cf296f654245d7
   4:     0x7fcf698ef138 - std::panicking::rust_panic_with_hook::h4cbd7ca63ce1aee9
   5:     0x7fcf630c8ac7 - std::panicking::begin_panic::hd3e81d866d6c5b0a
   6:     0x7fcf630d96a5 - rustc_errors::Handler::bug::h60f29cdeff67c1a3
   7:     0x7fcf66b50054 - rustc::session::opt_span_bug_fmt::_{{closure}}::ha1319a72e07cd73b
   8:     0x7fcf66a91545 - rustc::session::opt_span_bug_fmt::h4badbc71bfeea6f9
   9:     0x7fcf66a91382 - rustc::session::bug_fmt::he780dcb9e1e8a7d5
  10:     0x7fcf68a986c9 - rustc_trans::type_of::unsized_info_ty::hf5272e7847c33a65
  11:     0x7fcf68a990c6 - rustc_trans::type_of::in_memory_type_of::hdd81758adcc42cd9
  12:     0x7fcf68aac0b6 - rustc_trans::abi::FnType::unadjusted::_{{closure}}::ha426c6eba79ff534
  13:     0x7fcf689a9fc1 - rustc_trans::abi::FnType::unadjusted::h9ba1517948e929af
  14:     0x7fcf68a2a219 - rustc_trans::declare::declare_fn::hcf17f99041b59a03
  15:     0x7fcf68a8e190 - rustc_trans::trans_item::TransItem::predefine::h2c5f61d2b590ea2f
  16:     0x7fcf689cb1f1 - rustc_trans::base::trans_crate::h37725bf3707576ff
  17:     0x7fcf69ca44dd - rustc_driver::driver::phase_4_translate_to_llvm::hf2ea1af0ff14ef82
  18:     0x7fcf69ce5c17 - rustc_driver::driver::compile_input::_{{closure}}::he0f41e0761e5765b
  19:     0x7fcf69cd857c - rustc_driver::driver::phase_3_run_analysis_passes::_{{closure}}::he5bb0058670d90b6
  20:     0x7fcf69c25158 - rustc::ty::context::TyCtxt::create_and_enter::h1ad8faffb62f0367
  21:     0x7fcf69c8d81f - rustc_driver::driver::compile_input::h4d6bc655b7baad10
  22:     0x7fcf69cba776 - rustc_driver::run_compiler::h9165e61fc2dd486f
  23:     0x7fcf69c016e2 - std::panicking::try::do_call::hc52dd3bdae996640
  24:     0x7fcf698fe746 - __rust_maybe_catch_panic
  25:     0x7fcf69c1ad7a - _<F as alloc..boxed..FnBox<A>>::call_box::h3aad53cfb9d2713a
  26:     0x7fcf698ecd32 - std::sys::thread::Thread::new::thread_start::h4c0ad33b336bc6ea
  27:     0x7fcf628706f9 - start_thread
  28:     0x7fcf69530b5c - clone
  29:                0x0 - <unknown>
@TimNN
Copy link
Contributor

TimNN commented Oct 5, 2016

Duplicate of #16812, I think.

bors added a commit that referenced this issue Oct 25, 2016
Disallow Unsized Enums

Fixes #16812.

This PR is a potential fix for #16812, an issue which is reported [again](#36801) and [again](#36975), with over a dozen duplicates by now.

This PR is mainly meant to promoted discussion about the issue and the correct way to fix it.

This is a [breaking-change] since the error is now reported during wfchecking, so that even the definition of a (potentially) unsized enum will cause an error (whereas it would previously cause an ICE at trans time if the enum was used in an unsized manner).
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

3 participants