about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-09-18 14:24:21 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-09-18 14:24:52 -0700
commit2ac64d91ac9df242c780d162863c8c0abce448b1 (patch)
tree99e82d86ca308fb3345f62f5d113ecc43bd587aa
parente3f5403052e53b557998315fae780b5431a8ce0b (diff)
change relative priority of auto-slice and auto-ptr
rationale: if you have an impl for &const ~[T] or &mut ~[T]
and one for &[T], the first will be more likely to work and not lead
to borrowck errors.  I could imagine us wanting to offer multiple
impls for methods we select the ptr-to-array when possible and
the slice when necessary.  Also, taking a ptr seems like fewer
adaptations than slicing, and we tend to prefer fewer adaptations.
-rw-r--r--src/rustc/middle/typeck/check/method.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs
index 8eb8f06a3ef..8486b9de02b 100644
--- a/src/rustc/middle/typeck/check/method.rs
+++ b/src/rustc/middle/typeck/check/method.rs
@@ -527,12 +527,12 @@ impl LookupContext {
          * Attempts both auto-slice and auto-ptr, as appropriate.
          */
 
-        match self.search_for_autosliced_method(self_ty, autoderefs) {
+        match self.search_for_autoptrd_method(self_ty, autoderefs) {
             Some(move mme) => { return Some(move mme); }
             None => {}
         }
 
-        match self.search_for_autoptrd_method(self_ty, autoderefs) {
+        match self.search_for_autosliced_method(self_ty, autoderefs) {
             Some(move mme) => { return Some(move mme); }
             None => {}
         }