Skip to content

Commit 53d3891

Browse files
committed
Merge remote-tracking branch 'jakub-/feature-gate-box-patterns'
2 parents e005ad3 + c539b10 commit 53d3891

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
- Start Date: 2014-11-17
2+
- RFC PR: (leave this empty)
3+
- Rust Issue: (leave this empty)
4+
5+
# Summary
6+
7+
Move `box` patterns behind a feature gate.
8+
9+
# Motivation
10+
11+
A recent RFC (https://github.com/rust-lang/rfcs/pull/462) proposed renaming `box` patterns to `deref`. The discussion that followed indicates that while the language community may be in favour of some sort of renaming, there is no significant consensus around any concrete proposal, including the original one or any that emerged from the discussion.
12+
13+
This RFC proposes moving `box` patterns behind a feature gate to postpone that discussion and decision to when it becomes more clear how `box` patterns should interact with types other than `Box`.
14+
15+
In addition, in the future `box` patterns are expected to be made more general by enabling them to destructure any type that implements one of the `Deref` family of traits. As such a generalisation may potentially lead to some currently valid programs being rejected due to the interaction with type inference or other language features, it is desirable that this particular feature stays feature gated until then.
16+
17+
# Detailed design
18+
19+
A feature gate `box_patterns` will be defined and all uses of the `box` pattern will require said gate to be enabled.
20+
21+
# Drawbacks
22+
23+
Some currently valid Rust programs will have to opt in to another feature gate.
24+
25+
# Alternatives
26+
27+
Pursue https://github.com/rust-lang/rfcs/pull/462 before 1.0 and stabilise `box patterns` without a feature gate.
28+
29+
Leave `box` patterns as-is without putting them behind a feature gate.
30+
31+
# Unresolved questions
32+
33+
None.

0 commit comments

Comments
 (0)