summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMichael Hewson <michael@michaelhewson.ca>2017-11-02 07:58:21 -0400
committerMichael Hewson <michael@michaelhewson.ca>2017-11-07 13:36:10 -0500
commit497397ab4b66e40f3a772544a1bb9842869cf118 (patch)
tree56553d6417b8867456b8acd3c89c4e8fff2fa2a1 /src/libsyntax
parentedc8c760e0ab7c6bd09ac041228af84668fa7620 (diff)
downloadrust-497397ab4b66e40f3a772544a1bb9842869cf118.tar.gz
rust-497397ab4b66e40f3a772544a1bb9842869cf118.zip
initial implementation of arbitrary_self_types
If the feature is enabled, allow method `self` types to be any type
that auto-derefs to `self`.
- Currently, this supports inherent methods as well as trait methods.
The plan AFAIK is to only allow this for trait methods, so I guess it
won’t stay this way
- Dynamic dispatch isn’t implemented yet, so the compiler will ICE if
you define a trait method that takes `self: Rc<Self>` and try to call
it on an `Rc<Trait>`. I will probably just make those methods
non-object-safe initially.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index a69bf53ee14..b6cb3ac1308 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -409,6 +409,9 @@ declare_features! (
 
     // extern types
     (active, extern_types, "1.23.0", Some(43467)),
+
+    // Allow trait methods with arbitrary self types
+    (active, arbitrary_self_types, "1.23.0", Some(44874)),
 );
 
 declare_features! (