Skip to content

Commit

Permalink
Feature gate box patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Bukaj committed Nov 17, 2014
1 parent af3b33a commit c539b10
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions text/0000-feature-gate-box-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- Start Date: 2014-11-17
- RFC PR: (leave this empty)
- Rust Issue: (leave this empty)

# Summary

Move `box` patterns behind a feature gate.

# Motivation

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.

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`.

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.

# Detailed design

A feature gate `box_patterns` will be defined and all uses of the `box` pattern will require said gate to be enabled.

# Drawbacks

Some currently valid Rust programs will have to opt in to another feature gate.

# Alternatives

Pursue https://github.com/rust-lang/rfcs/pull/462 before 1.0 and stabilise `box patterns` without a feature gate.

Leave `box` patterns as-is without putting them behind a feature gate.

# Unresolved questions

None.

0 comments on commit c539b10

Please sign in to comment.