mirror of https://github.com/rust-lang/rust.git
safe transmute: reference tracking issue
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925266769
This commit is contained in:
parent
21d1ab4877
commit
b78c3daad0
|
@ -28,7 +28,7 @@ mod valid_align;
|
|||
pub(crate) use valid_align::ValidAlign;
|
||||
|
||||
mod transmutability;
|
||||
#[unstable(feature = "transmutability", issue = "none")]
|
||||
#[unstable(feature = "transmutability", issue = "99571")]
|
||||
pub use transmutability::{Assume, BikeshedIntrinsicFrom};
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// This trait is implemented on-the-fly by the compiler for types `Src` and `Self` when the bits of
|
||||
/// any value of type `Self` are safely transmutable into a value of type `Dst`, in a given `Context`,
|
||||
/// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied.
|
||||
#[unstable(feature = "transmutability", issue = "none")]
|
||||
#[unstable(feature = "transmutability", issue = "99571")]
|
||||
#[cfg_attr(not(bootstrap), lang = "transmute_trait")]
|
||||
#[rustc_on_unimplemented(
|
||||
message = "`{Src}` cannot be safely transmuted into `{Self}` in the defining scope of `{Context}`.",
|
||||
|
@ -22,7 +22,7 @@ pub unsafe trait BikeshedIntrinsicFrom<
|
|||
}
|
||||
|
||||
/// What transmutation safety conditions shall the compiler assume that *you* are checking?
|
||||
#[unstable(feature = "transmutability", issue = "none")]
|
||||
#[unstable(feature = "transmutability", issue = "99571")]
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub struct Assume {
|
||||
/// When `true`, the compiler assumes that *you* are ensuring (either dynamically or statically) that
|
||||
|
|
|
@ -4,3 +4,6 @@
|
|||
|
||||
use std::mem::BikeshedIntrinsicFrom;
|
||||
//~^ ERROR use of unstable library feature 'transmutability' [E0658]
|
||||
|
||||
use std::mem::Assume;
|
||||
//~^ ERROR use of unstable library feature 'transmutability' [E0658]
|
||||
|
|
|
@ -4,8 +4,18 @@ error[E0658]: use of unstable library feature 'transmutability'
|
|||
LL | use std::mem::BikeshedIntrinsicFrom;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
|
||||
= help: add `#![feature(transmutability)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0658]: use of unstable library feature 'transmutability'
|
||||
--> $DIR/feature-missing.rs:8:5
|
||||
|
|
||||
LL | use std::mem::Assume;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
|
||||
= help: add `#![feature(transmutability)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
Loading…
Reference in New Issue