Skip to content

ICE: unexpected definition: std::mem::size_of #38155

Closed
@mzji

Description

@mzji

Code:

fn main() {
    std::mem::size_of(u16);
}

Console output:

Running "cargo build":
   Compiling compiler_confirm v0.1.0 (file:///C:/Users/MYUSERNAME/Documents/Rust/compiler_confirm)
error[E0061]: this function takes 0 parameters but 1 parameter was supplied
 --> src\main.rs:2:23
  |
2 |     std::mem::size_of(u16);
  |                       ^^^ expected 0 parameters

error: internal compiler error: ../src/librustc_typeck\check/mod.rs:4396: unexpected definition: PrimTy(TyUint(u16))

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 'Box<Any>', ../src/librustc_errors/lib.rs:423
stack backtrace:
   0:     0x7ffa903f035a - std::panicking::Location::line::h9363ce800e842170
   1:     0x7ffa903ef7e4 - std::panicking::Location::line::h9363ce800e842170
   2:     0x7ffa903f323d - std::panicking::rust_panic_with_hook::hc790e47d4ecc86cd
   3:     0x7ffa8fea2670 - <unknown>
   4:     0x7ffa8febb09e - rustc_errors::Handler::bug::h620f7270292f0095
   5:     0x7ffa8e1a6105 - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   6:     0x7ffa8e1a5f3a - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   7:     0x7ffa8e1a56ac - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   8:     0x7ffa8e7c9bca - rustc_typeck::check::FnCtxt::instantiate_value_path::h4229ac945aebfa55
   9:     0x7ffa8e7b4206 - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  10:     0x7ffa8e7b2c31 - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  11:     0x7ffa8e7a5f7e - rustc_typeck::check::FnCtxt::field_ty::h272a018819ad38df
  12:     0x7ffa8e776ba7 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_call::h762a25d0c9a1f5b4
  13:     0x7ffa8e775b93 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_call::h762a25d0c9a1f5b4
  14:     0x7ffa8e7b3fad - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  15:     0x7ffa8e7b2c31 - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  16:     0x7ffa8e7c7fab - rustc_typeck::check::FnCtxt::check_stmt::h155d968e61fdfae6
  17:     0x7ffa8e7c836e - rustc_typeck::check::FnCtxt::check_block_no_value::h3ac235dc3eaa76c3
  18:     0x7ffa8e7b311e - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  19:     0x7ffa8e7b2c31 - rustc_typeck::check::FnCtxt::check_struct_path::hd07032c88b73af38
  20:     0x7ffa8e792acd - <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_ty::hdcba5921c886305a
  21:     0x7ffa8e790e17 - rustc_typeck::check::check_drop_impls::hb6e6926f4342f9e2
  22:     0x7ffa8e795191 - rustc_typeck::check::check_item_body::h1e039ede2f960fb9
  23:     0x7ffa8e78da7d - rustc_typeck::check::check_item_bodies::hd22adb7703cc56d7
  24:     0x7ffa8e816e40 - rustc_typeck::check_crate::h92f6bdfe03b6afba
  25:     0x7ffa900ab53e - rustc_driver::driver::count_nodes::h84f03318ea2320a8
  26:     0x7ffa90004e0b - <unknown>
  27:     0x7ffa900875a2 - rustc_driver::driver::compile_input::h8e119234b60571d5
  28:     0x7ffa900d8957 - rustc_driver::run_compiler::h57c4f233cd1a0c04
  29:     0x7ffa8ffbd7de - <unknown>
  30:     0x7ffa903f5c01 - _rust_maybe_catch_panic
  31:     0x7ffa8ffe72e4 - <unknown>
  32:     0x7ffa903ed8ae - std::sys::imp::thread::Thread::new::hd990f5dcc0d4bad9
  33:     0x7ffac1388363 - BaseThreadInitThunk

error: Could not compile `compiler_confirm`.

To learn more, run the command again with --verbose.

"cargo build" completed with code 101
It took approximately 0.786 seconds

rustc info:

rustc 1.15.0-nightly (908dba0c9 2016-12-01)
binary: rustc
commit-hash: 908dba0c9477b7dd022a236cb1514ddfca9369f2
commit-date: 2016-12-01
host: x86_64-pc-windows-msvc
release: 1.15.0-nightly
LLVM version: 3.9

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions