What it does
disallows from_exposed_addr(ptr.addr()) if the code is under #![feature(strict_provenance)]. The argument of from_exposed_addr can be value of expose_addr while addr cannot.
Lint Name
create_ptr_from_unexposed_addr
Category
correctness
Advantage
Drawbacks
None
Example
#![feature(strict_provenance)]
fn main() {
let elem = 0u64;
let x: *const u8 = std::ptr::from_exposed_addr((&elem as *const u64).addr())
}
Could be written as:
let elem = 0u64;
let x: *const u8 = std::ptr::from_exposed_addr((&elem as *const u64).exposed_addr())
What it does
disallows
from_exposed_addr(ptr.addr())if the code is under#![feature(strict_provenance)]. The argument offrom_exposed_addrcan be value ofexpose_addrwhileaddrcannot.Lint Name
create_ptr_from_unexposed_addr
Category
correctness
Advantage
Drawbacks
None
Example
Could be written as: