Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#103489 - WaffleLapkin:byte_offset_from_you,…
… r=scottmcm Make `pointer::byte_offset_from` more generic As suggested by rust-lang#96283 (comment) (cc ``@scottmcm),`` make `pointer::byte_offset_from` work on pointers of different types. `byte_offset_from` really doesn't care about pointer types, so this is totally fine and, for example, allows patterns like this: ```rust ptr::addr_of!(x.b).byte_offset_from(ptr::addr_of!(x)) ``` The only possible downside is that this removes the `T` == `U` hint to inference, but I don't think this matter much. I don't think there are a lot of cases where you'd want to use `byte_offset_from` with a pointer of unbounded type (and in such cases you can just specify the type). ``@rustbot`` label +T-libs-api
- Loading branch information