Closed
Description
With the recent transmute changes, several safe cases are now reported as errors. The most trivial is:
unsafe fn f<T>(i: T) ->T { std::mem::transmute(i) }
Another is:
struct Plane<T> { values : [T, ..4] }
struct Vec4<T> { values : [T, ..4] }
impl<T> Plane<T> {
unsafe fn to_vec4(&self) -> Vec4<T> {
std::mem::transmute(self.values)
}
}
There are obviously workarounds, but these are examples that are safe where the type-checker gets in the way. It is also unfortunate that the code is marked as "unsafe", yet the compiler rejects the code.
Metadata
Metadata
Assignees
Labels
No labels