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

Support subslice patterns #4917

Open
3 of 5 tasks
Undin opened this issue Feb 4, 2020 · 2 comments
Open
3 of 5 tasks

Support subslice patterns #4917

Undin opened this issue Feb 4, 2020 · 2 comments
Labels
feature meta Top level/tracking issue that group collections of related issues rust Issues about new language features

Comments

@Undin
Copy link
Member

Undin commented Feb 4, 2020

Subslice patterns will be stabilized in 1.42. It would be great to support them in the plugin.
Some technical details can be found in rust-lang/rust#67712

@Undin Undin added meta Top level/tracking issue that group collections of related issues feature rust Issues about new language features labels Feb 4, 2020
@mchernyavsky mchernyavsky self-assigned this Mar 16, 2020
bors bot added a commit that referenced this issue Mar 21, 2020
5114: ANN: Annotate slice patterns as experimental r=mchernyavsky a=mchernyavsky

Relates to #4917.

Co-authored-by: Mikhail Chernyavsky <Mikhail.Chernyavsky@jetbrains.com>
bors bot added a commit that referenced this issue Mar 21, 2020
5114: ANN: Annotate slice patterns as experimental r=Undin a=mchernyavsky

Relates to #4917.

Co-authored-by: Mikhail Chernyavsky <Mikhail.Chernyavsky@jetbrains.com>
@fujiapple852
Copy link

fujiapple852 commented Apr 6, 2020

I see from the above that type inference is not yet available for subslice patterns and therefore presumably I shouldn't expect the type of xs to be inferred correctly at the moment?

fn foo() {
    fn bar(_: &[&str]) {}
    match vec![""].as_slice() {
        [] => {},
        [_, xs @ ..] => bar(xs)
    }
}

Currently this gives a type inference error in the IDE:

mismatched types [E0308] expected `&[&str]`, found `&&str`

If not let me know and I'll raise a bug.

bors bot added a commit that referenced this issue Apr 13, 2020
5226: TY: Type inference for subslice patterns r=Undin a=mchernyavsky

Relates to #4917.

Co-authored-by: mchernyavsky <chernyavsky.mikhail@gmail.com>
@Undin
Copy link
Member Author

Undin commented Apr 13, 2020

@fujiapple852 type inference is implemented in #5226
You can try it in tomorrow nightly build. See instruction how to install nightly plugin version

@mchernyavsky mchernyavsky removed their assignment May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature meta Top level/tracking issue that group collections of related issues rust Issues about new language features
Projects
None yet
Development

No branches or pull requests

3 participants