Skip to content

Type inference regression #38323

@Arvamer

Description

@Arvamer

Following code compiles on stable but fails on nightly:

fn main() {
    let v = [1u16, 2, 3, 4];
    let idx = "1".parse().unwrap();
    println!("{:?}", v.get(idx));
}

rustc version:

rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
binary: rustc
commit-hash: daf8c1dfce3b448fc581cc319f64632ec22bd0e1
commit-date: 2016-12-05
host: x86_64-unknown-linux-gnu
release: 1.15.0-nightly
LLVM version: 3.9

Activity

bluss

bluss commented on Dec 12, 2016

@bluss
Member

Ah, this is from SliceIndex; <[T]>::get is generic in the index type now. Added in #36340

Arvamer

Arvamer commented on Dec 12, 2016

@Arvamer
Author

So that's why rustc can't infer type… It's not a big deal and it looks like it's know regression so I will just fix it in my crate, gilrs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bluss@Arvamer

        Issue actions

          Type inference regression · Issue #38323 · rust-lang/rust