Skip to content

Commit

Permalink
Fixed soundness hole uncovered by a rustc bugfix. This causes a break…
Browse files Browse the repository at this point in the history
…ing change.
  • Loading branch information
Kimundi committed Jul 31, 2016
1 parent caa3475 commit 87b4811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "owning_ref"
version = "0.1.4"
version = "0.2.0"
authors = ["Marvin Löbel <loebel.marvin@gmail.com>"]
license = "MIT"

Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<T> Erased for T {}
/// Helper trait for erasing the concrete type of what an owner derferences to,
/// for example `Box<T> -> Box<Erased>`. This would be unneeded with
/// higher kinded types support in the language.
pub unsafe trait IntoErased {
pub unsafe trait IntoErased<'a> {
/// Owner with the dereference type substituted to `Erased`.
type Erased;
/// Perform the type erasure.
Expand Down Expand Up @@ -304,8 +304,8 @@ impl<O, T: ?Sized> OwningRef<O, T> {
/// assert_eq!(*owning_refs[1], 1);
/// }
/// ```
pub fn erase_owner(self) -> OwningRef<O::Erased, T>
where O: IntoErased,
pub fn erase_owner<'a>(self) -> OwningRef<O::Erased, T>
where O: IntoErased<'a>,
{
OwningRef {
reference: self.reference,
Expand Down Expand Up @@ -442,15 +442,15 @@ pub type RwLockReadGuardRef<'a, T, U = T>
pub type RwLockWriteGuardRef<'a, T, U = T>
= OwningRef<RwLockWriteGuard<'a, T>, U>;

unsafe impl<'a, T: 'a> IntoErased for Box<T> {
unsafe impl<'a, T: 'a> IntoErased<'a> for Box<T> {
type Erased = Box<Erased + 'a>;
fn into_erased(self) -> Self::Erased { self }
}
unsafe impl<'a, T: 'a> IntoErased for Rc<T> {
unsafe impl<'a, T: 'a> IntoErased<'a> for Rc<T> {
type Erased = Rc<Erased + 'a>;
fn into_erased(self) -> Self::Erased { self }
}
unsafe impl<'a, T: 'a> IntoErased for Arc<T> {
unsafe impl<'a, T: 'a> IntoErased<'a> for Arc<T> {
type Erased = Arc<Erased + 'a>;
fn into_erased(self) -> Self::Erased { self }
}
Expand Down

0 comments on commit 87b4811

Please sign in to comment.