]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #54280 - japaric:no-cas-for-thumbv6, r=alexcrichton
authorPietro Albini <pietro@pietroalbini.org>
Sat, 22 Sep 2018 07:56:28 +0000 (09:56 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Sep 2018 07:56:28 +0000 (09:56 +0200)
commite3cc48a4ce96c93d42f9329c2dbc695c1cb1177b
treede43d0b2112df1b1c2d8e2e6937a7c5cfcb2f3ef
parent822c51121e7379ad72c2a2ccfed3443ecc40fbf4
parent828289610bece3d2208d34147ae2a419a9c524c4
Rollup merge of #54280 - japaric:no-cas-for-thumbv6, r=alexcrichton

remove (more) CAS API from Atomic* types where not natively supported

closes #54276

In PR #51953 I made the Atomic* types available on targets like thumbv6m and
msp430 with the intention of *only* exposing the load and store API on those
types -- the rest of the API doesn't work on those targets because the are no
native instructions to implement CAS loops.

Unfortunately, it seems I didn't properly cfg away all the CAS API on those
targets, as evidenced in #54276. This PR amends the issue by removing the rest
of the CAS API.

This is technically a breaking change because *libraries* that were using this
API and were being compiled for e.g. thumbv6m-none-eabi will stop compiling.
However, using those libraries (before this change) in programs (binaries) would
lead to linking errors when compiled for e.g. thumbv6m so this change
effectively shifts a linker error in binaries to a compiler error in libraries.

On a side note: extending the Atomic API is a bit error prone because of these
non-cas targets. Unless the author of the change is aware of these targets and
properly uses `#[cfg(atomic = "cas")]` they could end up exposing new CAS API on
these targets. I can't think of a test to check that an API is not present on
some target, but we could extend the `tidy` tool to check that *all* newly added
atomic API has the `#[cfg(atomic = "cas")]` attribute unless it's whitelisted in
`tidy` then the author of the change would have to verify if the API can be used
on non-cas targets.

In any case, I'd like to plug this hole ASAP. We can revisit testing in a
follow-up issue / PR.

r? @alexcrichton
cc @mvirkkunen