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

Internal compiler error for windows OsStrExt #38399

Closed
novacrazy opened this issue Dec 15, 2016 · 6 comments
Closed

Internal compiler error for windows OsStrExt #38399

novacrazy opened this issue Dec 15, 2016 · 6 comments

Comments

@novacrazy
Copy link

novacrazy commented Dec 15, 2016

The code that produces the internal compiler error

//main.rs

use std::os::windows::ffi::OsStrExt;
use std::ffi::OsStr;

pub fn to_wstring(s: &str) -> Vec<u16> {
    OsStr::new(str).encode_wide().chain(Some(0).into_iter()).collect()
}

fn main() {}

pub on to_wstring doesn't make a difference, nor does removing the chain part.

Here is the error:

E:\code\projects\2016\test-case>cargo build
   Compiling test-case v0.1.0 (file:///E:/code/projects/2016/test-case)
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

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:423
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `test-case`.

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

Meta

Rust version:

rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
binary: rustc
commit-hash: daf8c1dfce3b448fc581cc319f64632ec22bd0e1
commit-date: 2016-12-05
host: x86_64-pc-windows-msvc
release: 1.15.0-nightly
LLVM version: 3.9

And here is the backtrace:

0:     0x7ff9fc2802ea - std::panicking::Location::line::h9363ce800e842170
1:     0x7ff9fc27f774 - std::panicking::Location::line::h9363ce800e842170
2:     0x7ff9fc2831cd - std::panicking::rust_panic_with_hook::hc790e47d4ecc86cd
3:     0x7ffa209f2670 - <unknown>
4:     0x7ffa20a0b09e - rustc_errors::Handler::bug::h620f7270292f0095
5:     0x7ff9f49c5e25 - rustc::session::bug_fmt::he2d2f00a4afa9d1e
6:     0x7ff9f49c5c5a - rustc::session::bug_fmt::he2d2f00a4afa9d1e
7:     0x7ff9f49c53cc - rustc::session::bug_fmt::he2d2f00a4afa9d1e
8:     0x7ff9fa349d1a - rustc_typeck::check::FnCtxt::instantiate_value_path::h4229ac945aebfa55
9:     0x7ff9fa334356 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
10:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
11:     0x7ff9fa3260ce - rustc_typeck::check::FnCtxt::field_ty::h3fce8b0238020251
12:     0x7ff9fa2f6ce7 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_call::h762a25d0c9a1f5b4
13:     0x7ff9fa2f5cd3 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_call::h762a25d0c9a1f5b4
14:     0x7ff9fa3340fd - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
15:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
16:     0x7ff9fa3337a4 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
17:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
18:     0x7ff9fa3337a4 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
19:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
20:     0x7ff9fa3337a4 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
21:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
22:     0x7ff9fa3484f3 - rustc_typeck::check::FnCtxt::check_block_no_value::h3ac235dc3eaa76c3
23:     0x7ff9fa33326e - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
24:     0x7ff9fa332d81 - rustc_typeck::check::FnCtxt::check_struct_path::h1ff2872963f8985c
25:     0x7ff9fa312c1d - <rustc_typeck::coherence::orphan::OrphanChecker<'cx, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item::habbc901b4cfa4531
26:     0x7ff9fa310f57 - rustc_typeck::check::check_drop_impls::hb6e6926f4342f9e2
27:     0x7ff9fa3152e1 - rustc_typeck::check::check_item_body::h1e039ede2f960fb9
28:     0x7ff9fa30dbbd - rustc_typeck::check::check_item_bodies::hd22adb7703cc56d7
29:     0x7ff9fa39a500 - rustc_typeck::check_crate::h92f6bdfe03b6afba
30:     0x7ff9fe24c98e - rustc_driver::driver::count_nodes::h84f03318ea2320a8
31:     0x7ff9fe1a5bcf - <unknown>
32:     0x7ff9fe228932 - rustc_driver::driver::compile_input::h8e119234b60571d5
33:     0x7ff9fe279f27 - rustc_driver::run_compiler::h57c4f233cd1a0c04
34:     0x7ff9fe15da1e - <unknown>
35:     0x7ff9fc285bf1 - _rust_maybe_catch_panic
36:     0x7ff9fe187794 - <unknown>
37:     0x7ff9fc27d86e - std::sys::imp::thread::Thread::new::hd990f5dcc0d4bad9
38:     0x7ffa3d3e8363 - BaseThreadInitThunk
@durka
Copy link
Contributor

durka commented Dec 15, 2016

This is a(nother) duplicate of #38155, which will be fixed whenever we manage to produce a new nightly (don't hold your breath). It's astounding how many people hit this regression. Maybe we need to add something about searching existing issues to the ICE message.

@novacrazy
Copy link
Author

Is there a buildable commit with a fix that I could compile locally?

@novacrazy
Copy link
Author

I'll try 7ad7232 and/or master

@nagisa
Copy link
Member

nagisa commented Dec 16, 2016

Your code is wrong. No need to search for new compilers.

    OsStr::new(str).encode_wide().chain(Some(0).into_iter()).collect() // wrong
    OsStr::new(s).encode_wide().chain(Some(0).into_iter()).collect()   // good

@novacrazy
Copy link
Author

Ah, I didn't notice my typo.

Still, an internal compiler error probably isn't the best error for something like that.

@sanxiyn
Copy link
Member

sanxiyn commented Dec 16, 2016

Closing as a duplicate.

@sanxiyn sanxiyn closed this as completed Dec 16, 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

4 participants