Skip to content

Commit 2ac64d9

Browse files
committed
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.
1 parent e3f5403 commit 2ac64d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rustc/middle/typeck/check/method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,12 @@ impl LookupContext {
527527
* Attempts both auto-slice and auto-ptr, as appropriate.
528528
*/
529529

530-
match self.search_for_autosliced_method(self_ty, autoderefs) {
530+
match self.search_for_autoptrd_method(self_ty, autoderefs) {
531531
Some(move mme) => { return Some(move mme); }
532532
None => {}
533533
}
534534

535-
match self.search_for_autoptrd_method(self_ty, autoderefs) {
535+
match self.search_for_autosliced_method(self_ty, autoderefs) {
536536
Some(move mme) => { return Some(move mme); }
537537
None => {}
538538
}

0 commit comments

Comments
 (0)