librustc: Remove cross-borrowing of Box<T> 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]
This commit is contained in:
@@ -67,7 +67,7 @@ impl<T:PartialEq> PartialEq for Box<T> {
|
||||
impl<T:PartialOrd> PartialOrd for Box<T> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
|
||||
(**self).partial_cmp(*other)
|
||||
(**self).partial_cmp(&**other)
|
||||
}
|
||||
#[inline]
|
||||
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
|
||||
@@ -80,7 +80,9 @@ impl<T:PartialOrd> PartialOrd for Box<T> {
|
||||
}
|
||||
impl<T: Ord> Ord for Box<T> {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
|
||||
fn cmp(&self, other: &Box<T>) -> Ordering {
|
||||
(**self).cmp(&**other)
|
||||
}
|
||||
}
|
||||
impl<T: Eq> Eq for Box<T> {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user