Skip to content

Commit 50ad9c2

Browse files
committed
safe transmute: revise safety analysis
Migrate to a simplified safety analysis that does not use visibility. Closes rust-lang/project-safe-transmute#15
1 parent 823d14f commit 50ad9c2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/src/mem/transmutability.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use crate::marker::ConstParamTy;
66
/// any value of type `Self` are safely transmutable into a value of type `Dst`, in a given `Context`,
77
/// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied.
88
#[unstable(feature = "transmutability", issue = "99571")]
9-
#[lang = "transmute_trait"]
9+
#[cfg_attr(not(bootstrap), lang = "transmute_trait")]
1010
#[rustc_deny_explicit_impl(implement_via_object = false)]
1111
#[rustc_coinductive]
12-
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
12+
pub unsafe trait BikeshedIntrinsicFrom<Src, const ASSUME: Assume = { Assume::NOTHING }>
1313
where
1414
Src: ?Sized,
1515
{
@@ -28,8 +28,9 @@ pub struct Assume {
2828
/// that violates Rust's memory model.
2929
pub lifetimes: bool,
3030

31-
/// When `true`, the compiler assumes that *you* have ensured that it is safe for you to violate the
32-
/// type and field privacy of the destination type (and sometimes of the source type, too).
31+
/// When `true`, the compiler assumes that *you* have ensured that no
32+
/// unsoundness will arise from violating the safety invariants of the
33+
/// destination type (and sometimes of the source type, too).
3334
pub safety: bool,
3435

3536
/// When `true`, the compiler assumes that *you* are ensuring that the source type is actually a valid

0 commit comments

Comments
 (0)