From de70d76373e05fcf0f421cedb185b08de10a714c Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 7 Jul 2014 16:35:15 -0700 Subject: librustc: Remove cross-borrowing of `Box` to `&T` from the language, except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change] --- src/liballoc/boxed.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 56506d798d9..89f6e934ad2 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -67,7 +67,7 @@ impl PartialEq for Box { impl PartialOrd for Box { #[inline] fn partial_cmp(&self, other: &Box) -> Option { - (**self).partial_cmp(*other) + (**self).partial_cmp(&**other) } #[inline] fn lt(&self, other: &Box) -> bool { *(*self) < *(*other) } @@ -80,7 +80,9 @@ impl PartialOrd for Box { } impl Ord for Box { #[inline] - fn cmp(&self, other: &Box) -> Ordering { (**self).cmp(*other) } + fn cmp(&self, other: &Box) -> Ordering { + (**self).cmp(&**other) + } } impl Eq for Box {} -- cgit 1.4.1-3-g733a5