#![feature(core)] #![feature(plugin)] #![plugin(clippy)] #![deny(useless_transmute)] extern crate core; use std::mem::transmute as my_transmute; use std::vec::Vec as MyVec; fn my_vec() -> MyVec { vec![] } #[allow(needless_lifetimes)] unsafe fn _generic<'a, T, U: 'a>(t: &'a T) { let _: &'a T = core::intrinsics::transmute(t); //~^ ERROR transmute from a type (`&'a T`) to itself let _: &'a U = core::intrinsics::transmute(t); } fn main() { unsafe { let _: Vec = core::intrinsics::transmute(my_vec()); //~^ ERROR transmute from a type (`collections::vec::Vec`) to itself let _: Vec = core::mem::transmute(my_vec()); //~^ ERROR transmute from a type (`collections::vec::Vec`) to itself let _: Vec = std::intrinsics::transmute(my_vec()); //~^ ERROR transmute from a type (`collections::vec::Vec`) to itself let _: Vec = std::mem::transmute(my_vec()); //~^ ERROR transmute from a type (`collections::vec::Vec`) to itself let _: Vec = my_transmute(my_vec()); //~^ ERROR transmute from a type (`collections::vec::Vec`) to itself let _: Vec = core::intrinsics::transmute(my_vec()); let _: Vec = core::mem::transmute(my_vec()); let _: Vec = std::intrinsics::transmute(my_vec()); let _: Vec = std::mem::transmute(my_vec()); let _: Vec = my_transmute(my_vec()); } }