Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix soundness issue in Yoke::attach_to_cart() around implied bounds #2949

Merged
merged 11 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions utils/yoke/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ fn yokeable_derive_impl(input: &DeriveInput) -> TokenStream2 {
f(self)
}
}
// This is safe because there are no lifetime parameters.
unsafe impl<'a, #(#tybounds),*> yoke::IsCovariant<'a> for #name<#(#typarams),*> where #(#static_bounds),* {}
}
} else {
if lts != 1 {
Expand Down Expand Up @@ -250,9 +248,6 @@ fn yokeable_derive_impl(input: &DeriveInput) -> TokenStream2 {
unsafe { f(core::mem::transmute::<&'a mut Self, &'a mut Self::Output>(self)) }
}
}
// This is safe because it is in the same block as the above impl, which only compiles
// if 'a is a covariant lifetime.
unsafe impl<'a, #(#tybounds),*> yoke::IsCovariant<'a> for #name<'a, #(#typarams),*> where #(#static_bounds),* {}
}
}
}
Expand Down
142 changes: 0 additions & 142 deletions utils/yoke/src/is_covariant.rs

This file was deleted.

2 changes: 0 additions & 2 deletions utils/yoke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ extern crate alloc;
pub mod either;
#[cfg(feature = "alloc")]
pub mod erased;
mod is_covariant;
mod macro_impls;
pub mod trait_hack;
mod yoke;
Expand All @@ -59,7 +58,6 @@ mod zero_from;
#[cfg(feature = "derive")]
pub use yoke_derive::Yokeable;

pub use crate::is_covariant::IsCovariant;
pub use crate::yoke::{CloneableCart, Yoke};
pub use crate::yokeable::Yokeable;

Expand Down
3 changes: 1 addition & 2 deletions utils/yoke/src/macro_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// than using pointer casts
#![allow(clippy::transmute_ptr_to_ptr)]

use crate::{IsCovariant, Yokeable};
use crate::Yokeable;
use core::{mem, ptr};

macro_rules! copy_yoke_impl {
Expand Down Expand Up @@ -38,7 +38,6 @@ macro_rules! impl_copy_type {
type Output = Self;
copy_yoke_impl!();
}
unsafe impl<'a> IsCovariant<'a> for $ty {}
};
}

Expand Down
Loading