rust icon indicating copy to clipboard operation
rust copied to clipboard

Remove `ptr` from `AtomicPtr::fetch_{add,sub}` method names

Open WaffleLapkin opened this issue 1 year ago • 6 comments

Rename AtomicPtr::{fetch_ptr_add => fetch_add, fetch_ptr_sub => fetch_sub}.

Reasoning TL;DR: new naming is consistent with other Atomic* and pointer methods, see https://github.com/rust-lang/rust/issues/99108#issuecomment-1272332432

r? @thomcc

WaffleLapkin avatar Oct 12 '22 15:10 WaffleLapkin

The Miri subtree was changed

cc @rust-lang/miri

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

rustbot avatar Oct 12 '22 15:10 rustbot

@rustbot label +T-libs-api -T-libs

WaffleLapkin avatar Oct 12 '22 15:10 WaffleLapkin

I agree this naming as-is is not ideal, but it was done deliberately to avoid the footgun described here: https://github.com/rust-lang/rust/pull/96935#issuecomment-1124317265. That is, the initial version of the PR used the names you describe and was changed to avoid confusion.

thomcc avatar Oct 12 '22 15:10 thomcc

That said I am in favor of changing the name. I think fetch_ptr_add implies it's in units of size_of::<*const T>() rather than size_of::<T>().

thomcc avatar Oct 12 '22 16:10 thomcc

Do you want to open an ACP about this as a place to hold the bikeshed coloring discussion?

thomcc avatar Oct 15 '22 20:10 thomcc

Yeah, I think it's a good idea

WaffleLapkin avatar Oct 17 '22 12:10 WaffleLapkin

Opened ACP: https://github.com/rust-lang/libs-team/issues/126

WaffleLapkin avatar Oct 24 '22 17:10 WaffleLapkin