diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-16 08:36:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 08:36:10 +0100 |
| commit | 91963cc244f4986818dadbb2c73dd6f67e779802 (patch) | |
| tree | f1c1232f5c5e2ef7e6e5788eb34b06ef02775119 /compiler/rustc_mir_transform/src/coverage/debug.rs | |
| parent | 5140bbd10258d8c0f5afb286d0fd57a296720652 (diff) | |
| parent | 6279d092c32bc60be2eeb91210f1d875e28b6b72 (diff) | |
| download | rust-91963cc244f4986818dadbb2c73dd6f67e779802.tar.gz rust-91963cc244f4986818dadbb2c73dd6f67e779802.zip | |
Rollup merge of #103489 - WaffleLapkin:byte_offset_from_you, r=scottmcm
Make `pointer::byte_offset_from` more generic As suggested by https://github.com/rust-lang/rust/issues/96283#issuecomment-1288792955 (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
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions
