-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking issue for bindings in sub-patterns after @s (feature(bindings_after_at)) #65490
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-codegenArea: Code generationArea: Code generationA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-bindings_after_at`#![feature(bindings_after_at)]``#![feature(bindings_after_at)]`T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-codegenArea: Code generationArea: Code generationA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-bindings_after_at`#![feature(bindings_after_at)]``#![feature(bindings_after_at)]`T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is the tracking issue for
#![feature(bindings_after_at)], which allows patterns of formbinding @ patto have bindings inpat, for exampleref x @ Some(y).Implementation history
On 2019-12-24, Initial implementation of
#![feature(bindings_after_at)]#66296, containing the initial implementation, landed. The PR was written by @Centril and reviewed by @pnkfelix and @matthewjasper.On 2020-02-10, Correctly parse
mut a @ b#68992 landed. The PR was written by @matthewjasper and reviewed by @Centril. The PR fixed a parser recovery bug whereinmut x @ ywould makeya mutable binding, manifesting as issues Wrong bindings_after_at warnings #67861 and bindings_after_at: outer mutability annotation affects inner bindings #67926.On 2020-02-19, parse: recover
mut (x @ y)as(mut x @ mut y). #69236 landed. The PR was written by @Centril and reviewed by @estebank. The PR adjusted the parser changes in Correctly parsemut a @ b#68992 to retain good error messages on e.g.mut (x @ y)patterns, suggestingmut x @ mut yas opposed tomut x @ y.On 2020-03-08, test(pattern): add tests for combinations of pattern features #69690 landed. The PR was written by @thekuom and reviewed by @Centril and added run-pass tests for the combination of bindings-after-at, or-patterns, box-patterns, slice-patterns.
On 2020-03-08, test(bindings_after_at): add dynamic drop tests for bindings_after_at #69810 landed. The PR was written by @thekuom and reviewed by @Centril and added dynamic-rop run-pass tests for bindings-after-at.
On 2020-03-10, test(patterns): add patterns feature tests to borrowck test suite #69817, written by @thekuom and reviewed by @Centril, landed. The PR added borrow checker tests in combination with or-patterns & other pattern features.
On 2020-03-26, borrowck: prefer "value" over "
_" in diagnostics #70389, written by @Centril and reviewed by @mark-i-m, landed. The PR fixed some bugs in diagnostics where we would end up using_as the name of the place when matching on a temporary. Now it says "value" in the diagnostic instead.Old description
Pre-1.0 Rust used to support writing code like:
PR #16053 disabled the ability to write such code. More precisely, it disabled the ability to introduce any kind of binding in subpattern
Pin the context of any binding-patternident @ PThe reason we did this was because it was too hard to handle them soundly in the AST-borrowck.
However, now that we have migrated 100% to NLL and thus MIR-borrowck, we should be able to soundly re-enable this feature, without too much effort (I hope).
ty::Ref(_, adt_ty @ ty::TyS { kind: ty::Adt(adt_def, _), .. }, _))Note that any attempt to re-enable the feature should do a careful survey of the various cases that can arise (copying, moving, mixing ref and non-ref, match ergonomics, ...)
Also, any attempt to re-enable the feature should also attempt to re-add all the tests that were removed with PR #16053