tokio-rs / bytes

Utilities for working with bytes
MIT License
1.87k stars 278 forks source link

Make strict provenance compatible #542

Closed Darksonn closed 2 years ago

Darksonn commented 2 years ago

This PR replaces all ptr2int2ptr casts with an wrapping_add equivalent, making it strict-provenance compatible.

thomcc commented 2 years ago

FYI, the optimization you do to avoid the bad codegen causes (non-theoretical) LLVM miscompiles -- See https://github.com/rust-lang/rust/pull/96538 for some details. So I don't know if you should keep it.

hawkw commented 2 years ago

welp. that's cool.

Darksonn commented 2 years ago

@thomcc Thanks. We will uses ptr2int2ptr casts for now on non-miri builds then.