E0710: Cannot infer pointee type
| Code | Category | Stability |
|---|---|---|
E0710 | Intrinsic | Permanent |
Explanation
@int_to_ptr converts a u64 address to ptr mut T, but the address alone does not say what T is. Rue therefore takes the pointee type from the context in which the resulting pointer is used.
Likely cause
The pointer result is discarded or assigned to a binding without a pointer type annotation, and no later use constrains the pointer to one concrete pointee type.
Examples
Discard a pointer with no inferred pointee
fn main() {
checked {
let address: u64 = 0;
@int_to_ptr(address);
}
}
Annotate the pointer result
fn main() {
checked {
let address: u64 = 0;
let pointer: ptr mut u8 = @int_to_ptr(address);
}
}