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

Implement Pattern Guards with Bind-By-Move #15287

Open
alexcrichton opened this Issue Jun 30, 2014 · 11 comments

Comments

Projects
None yet
8 participants
@alexcrichton
Copy link
Member

alexcrichton commented Jun 30, 2014

Tracking issue for "Pattern Guards with Bind-By-Move" (rust-lang/rfcs#107)

Steps:

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Nov 30, 2016

Triage: this has still not been implemented

@jonhoo

This comment has been minimized.

Copy link
Contributor

jonhoo commented Mar 31, 2017

I keep running into this (or rather, the simpler #14252) in places where I now end up with an extra level of indentation:

match x {
    Foo(v) => if do_a {
            // ...
        } else if do_b {
            // ...
        } else if do_c {
            // ...
        } else {
            // ...
        }
}

when it could be

match x {
    Foo(v) if do_a => {
        // ...
    },
    Foo(v) if do_b => {
        // ...
    },
    Foo(v) if do_c => {
        // ...
    },
    Foo(v) => {
        // ...
  }
}

andjo403 pushed a commit to andjo403/rust that referenced this issue May 16, 2017

andjo403 pushed a commit to andjo403/rust that referenced this issue May 17, 2017

andjo403 pushed a commit to andjo403/rust that referenced this issue May 17, 2017

andjo403 pushed a commit to andjo403/rust that referenced this issue May 18, 2017

andjo403 pushed a commit to andjo403/rust that referenced this issue May 18, 2017

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Jul 12, 2018

(i believe this feature is effectively implemented by NLL, namely as PR #49870. I should probably port any examples, including corner case examples noted on PR #42088, to the NLL test suite just to make sure.)

@pnkfelix pnkfelix self-assigned this Jul 12, 2018

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Jul 13, 2018

Actually perhaps the right thing for me to do would be to put in the feature(bind_by_move_pattern_guards) and then have that, when NLL is enabled, be the thing that toggles what is currently controlled by -Z disable_ast_check_for_mutation_in_guard

bors added a commit that referenced this issue Sep 18, 2018

Auto merge of #54034 - pnkfelix:issue-15287-bind-by-move-pattern-guar…
…ds, r=nikomatsakis

Add feature to enable bind by move pattern guards

Implement #15287 as described on #15287 (comment)

@pnkfelix pnkfelix removed the E-needstest label Sep 19, 2018

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Sep 19, 2018

Now that PR #54034 has landed, I'm unassigning myself.

(But, if I understand correctly, the issue should stay open until feature(bind_by_move_pattern_guards) gets stabilized)

@pnkfelix pnkfelix removed their assignment Sep 19, 2018

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Sep 24, 2018

(I guess it would be good to remove the -Zdisable-ast-check-for-mutation-in-guard flag and replaces uses of it in our test suite with #![feature(bind_by_move_pattern_guards)])

@pnkfelix pnkfelix self-assigned this Sep 24, 2018

bors added a commit that referenced this issue Oct 1, 2018

Auto merge of #54676 - pnkfelix:issue-15287-kill-zflag-disabling-ast-…
…check, r=alexcrichton

Remove `-Z disable_ast_check_for_mutation_in_guard`

One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard`

cc #15287

kennytm added a commit to kennytm/rust that referenced this issue Oct 1, 2018

Rollup merge of rust-lang#54676 - pnkfelix:issue-15287-kill-zflag-dis…
…abling-ast-check, r=alexcrichton

Remove `-Z disable_ast_check_for_mutation_in_guard`

One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard`

cc rust-lang#15287
@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Nov 9, 2018

unassigning this from myself; I've done the porting to the NLL test suite, but I have higher priority things on my plate to take care of before I go on leave.

(I invite anyone to come and pick up the torch for following through on the remaining steps here!)

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Dec 21, 2018

since this is implemented and all that remains is 1. making NLL the default everywhere and then 2. stabilizing the feature, I'll let this be handled by T-lang alone now, not T-compiler.

  • step 1 might even be optional, if we're willing to stabilize this feature solely on editions >= 2018 for now.

@pnkfelix pnkfelix removed the T-compiler label Dec 21, 2018

@Centril Centril added the I-nominated label Dec 21, 2018

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Dec 21, 2018

Nominated for next T-lang meeting to see how we want to proceed, specifically re. @pnkfelix's note re. step 1.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 3, 2019

In principle I guess stabilizing for Rust 2018 is fine. I'm not sure how much impl complexity that results in -- if nothing else it means more complex branches. I'm a bit wary.

@Centril Centril removed the I-nominated label Jan 3, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 3, 2019

I guess in general I would rather wait until NLL has proceeded further down the stability path to take action here. In particular, I'd like to see NLL enabled on all editions first and without any "outstanding questions", essentially (e.g. the 2PB one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.