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: UnsizeLength with bad sty #16783

Closed
dotdash opened this issue Aug 27, 2014 · 3 comments · Fixed by #16802
Closed

ICE: UnsizeLength with bad sty #16783

dotdash opened this issue Aug 27, 2014 · 3 comments · Fixed by #16802

Comments

@dotdash
Copy link
Contributor

dotdash commented Aug 27, 2014

This code:

fn main() {
    let x = [1, 2, 3];
    let y = x.as_slice();
}

Fails with:

slicesize.rs:3:13: 3:14 error: internal compiler error: UnsizeLength with bad sty: [type error]
slicesize.rs:3     let y = x.as_slice();
                           ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/bs/src/rust/src/libsyntax/ast_util.rs:776

The ICE does not happen when the integer type is known, e.g. by using 1u8 as the first value.

@nrc
Copy link
Member

nrc commented Aug 27, 2014

cc me

@nrc
Copy link
Member

nrc commented Aug 27, 2014

I'll look at this tomorrow.

nrc added a commit to nrc/rust that referenced this issue Aug 27, 2014
@nodakai
Copy link
Contributor

nodakai commented Aug 30, 2014

I hit an ICE with this code

fn main() {
    [0].len();
}
slice_to_vec.rs:2:5: 2:8 error: internal compiler error: borrow-vec associated with bad sty: &ty_err
slice_to_vec.rs:2     [0].len();
                      ^~~

[].len(); gave the same ICE but [0i].len(); was OK.

Will the above commit fix this ICE, too?

rustc 0.12.0-pre-nightly (5fb2dfa 2014-08-25 12:10:56 +0000)

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

Successfully merging a pull request may close this issue.

3 participants