Safe Transmute: Check mutability before creating dst -> src obligation
- Only create dst -> src obligation if Dst is mutable - Add some long comments to explain parts of the transmutability code that were unclear to me when reading - Update/add tests
This commit is contained in:
parent
db3275c962
commit
6266358237
18 changed files with 129 additions and 64 deletions
|
@ -31,17 +31,20 @@ impl fmt::Debug for Byte {
|
|||
|
||||
pub(crate) trait Def: Debug + Hash + Eq + PartialEq + Copy + Clone {}
|
||||
pub trait Ref: Debug + Hash + Eq + PartialEq + Copy + Clone {
|
||||
fn min_align(&self) -> usize {
|
||||
1
|
||||
}
|
||||
fn min_align(&self) -> usize;
|
||||
|
||||
fn is_mutable(&self) -> bool {
|
||||
false
|
||||
}
|
||||
fn is_mutable(&self) -> bool;
|
||||
}
|
||||
|
||||
impl Def for ! {}
|
||||
impl Ref for ! {}
|
||||
impl Ref for ! {
|
||||
fn min_align(&self) -> usize {
|
||||
unreachable!()
|
||||
}
|
||||
fn is_mutable(&self) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "rustc")]
|
||||
pub mod rustc {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue