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 definition: PrimTy(TyStr) #38157

Closed
mzji opened this issue Dec 4, 2016 · 2 comments
Closed

ICE: unexpected definition: PrimTy(TyStr) #38157

mzji opened this issue Dec 4, 2016 · 2 comments

Comments

@mzji
Copy link

mzji commented Dec 4, 2016

Code:

#![feature(unicode)]

pub trait ToUtf16 {
    fn to_vec_u16(&self) -> Vec<u16>;
}

impl ToUtf16 for str {
    fn to_vec_u16(&self) -> Vec<u16> {
        let mut ret_val = vec![];
        str.chars().inspect(|ch| {
            let mut temp = [0u16; 2];
            ret_val.extend_from_slice(ch.encode_utf16(&mut temp));
        }).count();
        ret_val.push(0);
        ret_val
    }
}

fn main() {

}

Console output:

Running "cargo build":
   Compiling compiler_confirm v0.1.0 (file:///C:/Users/MYUSERNAME/Documents/Rust/compiler_confirm)
error: internal compiler error: ../src/librustc_typeck\check/mod.rs:4396: unexpected definition: PrimTy(TyStr)

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:     0x7ffa9068035a - std::panicking::Location::line::h9363ce800e842170
   1:     0x7ffa9067f7e4 - std::panicking::Location::line::h9363ce800e842170
   2:     0x7ffa9068323d - std::panicking::rust_panic_with_hook::hc790e47d4ecc86cd
   3:     0x7ffa90302670 - <unknown>
   4:     0x7ffa9031b09e - rustc_errors::Handler::bug::h620f7270292f0095
   5:     0x7ffa8e4c5655 - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   6:     0x7ffa8e4c548a - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   7:     0x7ffa8e4c4bfc - rustc::session::bug_fmt::he2d2f00a4afa9d1e
   8:     0x7ffa8eae9f8a - rustc_typeck::check::FnCtxt::instantiate_value_path::h4229ac945aebfa55
   9:     0x7ffa8ead45c6 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  10:     0x7ffa8ead2ff1 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  11:     0x7ffa8ead3a14 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  12:     0x7ffa8ead2ff1 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  13:     0x7ffa8ead3a14 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  14:     0x7ffa8ead2ff1 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  15:     0x7ffa8ead3a14 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  16:     0x7ffa8ead2ff1 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  17:     0x7ffa8eae836b - rustc_typeck::check::FnCtxt::check_stmt::h155d968e61fdfae6
  18:     0x7ffa8eae872e - rustc_typeck::check::FnCtxt::check_block_no_value::h3ac235dc3eaa76c3
  19:     0x7ffa8ead34de - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  20:     0x7ffa8ead2ff1 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
  21:     0x7ffa8eab2e8d - <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_ty::hdcba5921c886305a
  22:     0x7ffa8eab11c7 - rustc_typeck::check::check_drop_impls::hb6e6926f4342f9e2
  23:     0x7ffa8eab5506 - rustc_typeck::check::check_item_body::h1e039ede2f960fb9
  24:     0x7ffa8eaade2d - rustc_typeck::check::check_item_bodies::hd22adb7703cc56d7
  25:     0x7ffa8eb37c60 - rustc_typeck::check_crate::h92f6bdfe03b6afba
  26:     0x7ffa9094c10e - rustc_driver::driver::count_nodes::h84f03318ea2320a8
  27:     0x7ffa908a577f - <unknown>
  28:     0x7ffa90928172 - rustc_driver::driver::compile_input::h8e119234b60571d5
  29:     0x7ffa90979527 - rustc_driver::run_compiler::h57c4f233cd1a0c04
  30:     0x7ffa9085d7de - <unknown>
  31:     0x7ffa90685c01 - _rust_maybe_catch_panic
  32:     0x7ffa90887344 - <unknown>
  33:     0x7ffa9067d8ae - std::sys::imp::thread::Thread::new::hd990f5dcc0d4bad9
  34:     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.895 seconds

rustc info:

rustc 1.15.0-nightly (c80c31a50 2016-12-02)
binary: rustc
commit-hash: c80c31a502c838f9ec06f1003d7c61cf9de9d551
commit-date: 2016-12-02
host: x86_64-pc-windows-msvc
release: 1.15.0-nightly
LLVM version: 3.9
@petrochenkov
Copy link
Contributor

This is exactly the same issue as #38155

@mzji
Copy link
Author

mzji commented Dec 4, 2016

Ok, then it's a duplicate. Closed.

@mzji mzji closed this as completed Dec 4, 2016
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

2 participants