safe transmute: test to ensure that trait is correctly feature-gated

ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925265476
This commit is contained in:
Jack Wrenn 2022-07-21 17:43:25 +00:00
parent 4a15157bad
commit 402644f72f
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// The trait must not be available if its feature flag is absent.
#![crate_type = "lib"]
use std::mem::BikeshedIntrinsicFrom;
//~^ ERROR use of unstable library feature 'transmutability' [E0658]

View File

@ -0,0 +1,11 @@
error[E0658]: use of unstable library feature 'transmutability'
--> $DIR/feature-missing.rs:5:5
|
LL | use std::mem::BikeshedIntrinsicFrom;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(transmutability)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.