Skip to content

rustc panics when trying to call a method on a type [nightly] #38344

Closed
@chr4

Description

@chr4

rustc panics when trying to call a method on a type.

I tried this code:

fn main() {
    char.xxx();
}

I expected to see this happen: An error message telling me that the method doesn't exist or that I'm using it incorrectly.

Instead, this happened:

$ rustc test.rs
error: internal compiler error: ../src/librustc_typeck/check/mod.rs:4396: unexpected definition: PrimTy(TyChar)

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 'Box<Any>', ../src/librustc_errors/lib.rs:423
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Meta

$ rustc --version --verbose
rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
binary: rustc
commit-hash: daf8c1dfce3b448fc581cc319f64632ec22bd0e1
commit-date: 2016-12-05
host: x86_64-apple-darwin
release: 1.15.0-nightly
LLVM version: 3.9

Backtrace:

$ RUST_BACKTRACE=1 rustc test.rs
error: internal compiler error: ../src/librustc_typeck/check/mod.rs:4396: unexpected definition: PrimTy(TyChar)

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:
   1:        0x10decef7a - std::sys::imp::backtrace::tracing::imp::write::hbea47d9dd19b523c
   2:        0x10dedc26f - std::panicking::default_hook::{{closure}}::h6875a2976258b020
   3:        0x10dedbe1d - std::panicking::default_hook::h88ffbc5922643264
   4:        0x10dedc736 - std::panicking::rust_panic_with_hook::hc790e47d4ecc86cd
   5:        0x10dcab83a - std::panicking::begin_panic::h264cdc75d51b518b
   6:        0x10dcbe4c4 - rustc_errors::Handler::bug::h620f7270292f0095
   7:        0x10a87ac5c - rustc::session::opt_span_bug_fmt::{{closure}}::h4a9b70c3df8b4b3a
   8:        0x10a87aa69 - rustc::session::opt_span_bug_fmt::h7d83586c6e2c7ae6
   9:        0x10a87a5ea - rustc::session::bug_fmt::he2d2f00a4afa9d1e
  10:        0x10a0c578d - rustc_typeck::check::FnCtxt::instantiate_value_path::h4229ac945aebfa55
  11:        0x10a0b3c31 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
  12:        0x10a0b286d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
  13:        0x10a0b32a4 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
  14:        0x10a0b286d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
  15:        0x10a0c40b3 - rustc_typeck::check::FnCtxt::check_stmt::h155d968e61fdfae6
  16:        0x10a0c446e - rustc_typeck::check::FnCtxt::check_block_with_expected::he90dd72b6855e5e4
  17:        0x10a0b2d93 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
  18:        0x10a0b286d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
  19:        0x10a099663 - rustc_typeck::check::check_fn::h96bd864b4d4fc711
  20:        0x10a0981f7 - rustc_typeck::check::check_bare_fn::h87386ea43f4e272e
  21:        0x10a09b193 - rustc_typeck::check::check_item_body::h1e039ede2f960fb9
  22:        0x10a095dad - rustc_typeck::check::check_item_bodies::hd22adb7703cc56d7
  23:        0x10a1039de - rustc_typeck::check_crate::h92f6bdfe03b6afba
  24:        0x1096a14d0 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::hd97ec26bf3a98036
  25:        0x109689404 - rustc_driver::driver::phase_3_run_analysis_passes::h6d446abb74c09795
  26:        0x10967986a - rustc_driver::driver::compile_input::h8e119234b60571d5
  27:        0x1096c0a4b - rustc_driver::run_compiler::h57c4f233cd1a0c04
  28:        0x1095df088 - std::panicking::try::do_call::hf679f17bf3b43b0b
  29:        0x10dedecea - __rust_maybe_catch_panic
  30:        0x10960218f - <F as alloc::boxed::FnBox<A>>::call_box::h21b5b32059700da6
  31:        0x10dedb3b4 - std::sys::imp::thread::Thread::new::thread_start::h8084b1107992ae5b
  32:     0x7fffa0906aaa - _pthread_body
  33:     0x7fffa09069f6 - _pthread_start

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions