Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fetch_and, fetch_or, fetch_nand, fetch_xor to AtomicInt, AtomicUint #12964

Closed
wants to merge 1 commit into from

Conversation

gereeter
Copy link
Contributor

Fixes #12949.

@alexcrichton
Copy link
Member

Could you also add some tests exercising the code?

@gereeter
Copy link
Contributor Author

Okay, done.

@alexcrichton
Copy link
Member

Looks good to me, and just a few things needed:

  • Could you squash the commits into one?
  • Travis looks like it has some failures, be sure to run the tests!
  • This needs a rebase

@gereeter
Copy link
Contributor Author

Squashed, rebased, and passing Travis.

@gereeter
Copy link
Contributor Author

Gah. Apparently I can't write tests properly at all. Sorry. I've fixed my local build system (without me realizing it, it wasn't running most of the tests, so these failures didn't show up), however, so this shouldn't happen again.

@alexcrichton
Copy link
Member

ping @gereeter, were you able to fix your local checkout? If you're running low on time, I can take over this, I'd love to check it in!

@gereeter
Copy link
Contributor Author

Okay, this is really weird. It looks like nand is legitimately failing to work correctly, which is crazy, given how simple the code is - all the functions are one line of code differing only in which atomic function they call, yet only nand fails. Worse, the only operation I can think of that it could be doing to get 0x4e (78) out of 0xf731 and 0x137f is xor combined with only keeping the least significant byte. All the tests run fine on my machine, and it only seems to fail on android. I'm not sure what the problem is.

@alexcrichton
Copy link
Member

Let's not add the nand functions for now, I'll open an issue about them.

@alexcrichton
Copy link
Member

(#13226)

@gereeter
Copy link
Contributor Author

gereeter commented Apr 4, 2014

I've removed fetch_nand. This should be ready to merge.

@bors bors closed this Apr 4, 2014
@gereeter gereeter deleted the extended-atomics branch December 17, 2015 01:29
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 16, 2022
[code] make toggleInlayHints understand {off,on}UntilPressed

fixes rust-lang#12964
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 11, 2024
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 11, 2024
Fix rust-lang#12964 - false positive with `into_iter_without_iter`

changelog: FP: `into_iter_without_iter`: No longer lints when the `iter` or `iter_mut` implementation is not within the first `impl` block

fixes rust-lang#12964

---

I'm pretty new to this open-source thing, so hopefully I did everything right. Got a little annoyed this false positive was happening in my code and the issue was inactive for two weeks so I thought I'd fix it myself.

As an aside, maybe `iter.map(...).next()` could be linted against? I don't see that ever being preferred over `iter.next().map(...)`, and it could've prevented the bug here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add fetch_and, fetch_or, fetch_nand, fetch_xor to AtomicInt, AtomicUint
3 participants