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.
This commit is contained in:
Niko Matsakis 2012-09-18 14:24:21 -07:00
parent e3f5403052
commit 2ac64d91ac

View file

@ -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 => {}
}