Skip to content

Commit

Permalink
Remove unfixable AsRef FIXMEs.
Browse files Browse the repository at this point in the history
A long time ago, FIXMEs were left to implement
AsRef and AsRef for all types which implemented
Deref and DerefMut. This wasn't done at the time
because of #23442.

Unfortunately, it's not possible to add these
implementations backwards-compabily, since they
can cause conflicting implementation overlaps.
  • Loading branch information
cramertj committed Oct 19, 2017
1 parent a457e29 commit 194e0a8
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,6 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U>
}
}

// FIXME (#23442): replace the above impls for &/&mut with the following more general one:
// // As lifts over Deref
// impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> {
// fn as_ref(&self) -> &U {
// self.deref().as_ref()
// }
// }

// AsMut lifts over &mut
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized, U: ?Sized> AsMut<U> for &'a mut T where T: AsMut<U>
Expand All @@ -399,14 +391,6 @@ impl<'a, T: ?Sized, U: ?Sized> AsMut<U> for &'a mut T where T: AsMut<U>
}
}

// FIXME (#23442): replace the above impl for &mut with the following more general one:
// // AsMut lifts over DerefMut
// impl<D: ?Sized + Deref, U: ?Sized> AsMut<U> for D where D::Target: AsMut<U> {
// fn as_mut(&mut self) -> &mut U {
// self.deref_mut().as_mut()
// }
// }

// From implies Into
#[stable(feature = "rust1", since = "1.0.0")]
impl<T, U> Into<U> for T where U: From<T>
Expand Down

0 comments on commit 194e0a8

Please sign in to comment.