-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Description
I tried this code:
struct FatPtr<T> {
data: *const T,
len: usize,
}
pub union Repr<T> {
rust: *const [T],
rust_mut: *mut [T],
raw: FatPtr<T>,
}
impl<T> [T] {
pub const fn is_empty(&self) -> bool {
self.len() == 0
}
pub const fn len(&self) -> usize {
unsafe { Repr { rust: self }.raw.len }
}
}I expected to see this happen: *compile without error
Instead, this happened:
<source>:18:31: error: expected [* const [T=T?]] got [& [T=T REF: 46]]
7 | rust: *const [T],
| ~
......
18 | unsafe { Repr { rust: self }.raw.len }
| ^
see https://godbolt.org/z/KGE8qxzWc
Meta
- What version of Rust GCC were you using, git sha if possible. 74e8365