Coder Social home page Coder Social logo

atomic-polyfill's People

Contributors

bgamari avatar danbev avatar dirbaio avatar ketsuban avatar korken89 avatar mabezdev avatar notgull avatar rahix avatar vadixidav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

atomic-polyfill's Issues

Should deprecated stuff be available?

Currently this crate doesn't make available deprecated items in polyfilled mode. This includes:

  • The compare_and_swap method on all atomic types
  • The ATOMIC_XX_INIT consts
  • The spin_loop_hint function

To me this doesn't seem a big deal because if you're migrating some code from core::sync::atomic to atomic_polyfill you're already doing modifications,

OTOH it might be annoying to have code that compiles in non-polyfilled mode and fails in polyfilled mode. If we aim to be a complete drop-in replacement maybe deprecated items should be available too...

Thoughts?

Minimum Safe Rust Version

Does this crate have an MSRV policy? I doubt that it's any recent version of Rust (since it just re-exports core primitives or redefines them using relatively low-level types), but it would be nice to know for when users want to include it in their projects.

Won't build for 32bit systems, e.g. ESP32

This crate is required because shared-bus 0.2.3 now depends on it.

at 09:24:22 ❯ cargo build                                                                                      
   Compiling atomic-polyfill v0.1.6
   Compiling robotica-remote-rust v0.22.8 (/home/brian/tree/personal/robotica-remote-rust)
error[E0432]: unresolved import `core::sync::atomic::AtomicU64`
   --> /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/atomic-polyfill-0.1.6/src/lib.rs:8:17
    |
8   |         pub use core::sync::atomic::$atomic_type;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AtomicU64` in `sync::atomic`
...
195 | atomic_int!(u64, AtomicU64, u64_native, u64_cas, u64_full);
    | ----------------------------------------------------------
    | |                |
    | |                help: a similar name exists in the module: `AtomicU8`
    | in this macro invocation
    |
    = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `core::sync::atomic::AtomicI64`
   --> /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/atomic-polyfill-0.1.6/src/lib.rs:8:17
    |
8   |         pub use core::sync::atomic::$atomic_type;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AtomicI64` in `sync::atomic`
...
200 | atomic_int!(i64, AtomicI64, i64_native, i64_cas, i64_full);
    | ----------------------------------------------------------
    | |                |
    | |                help: a similar name exists in the module: `AtomicI8`
    | in this macro invocation
    |
    = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0432`.
error: could not compile `atomic-polyfill` due to 2 previous errors

Support for target msp430-none-elf

I am currently working on a project on an MSP430 and embassy-executor appears to require an implementation of atomic-polyfill for this target. I can cook up a patched version on a fork and submit a PR. Creating this issue to track.

Revisit Build-Script Polyfill Level Granularity

The compile-time features in the crate are fairly granular, but in build.rs they are more coarse.
In practice, this means that platforms such as AVR can't express that they natively support some
atomic operations on small-width integer types, but need polyfills on larger ones to the build process.

Would you be open to a patch that makes the built-in tuning in build.rs a bit more granular?

Implement Arc and Weak using items from this crate

I'd like to use this in a crate that also uses Arc. Theoretically, it should be possible to also re-export/re-implement the Arc and Weak types using this crate. Maybe lock it behind an alloc feature for targets without an allocator available.

I can implement this PR myself.

Does not compile for AVR

I was unable to compile the latest release or latest master using nightly. In order to get it to compile successfully, I had to bring in the master version of critical-section instead of 0.2.7.

jeremy@jeremy-desktop:~/apechem/atomic-polyfill$ cargo +nightly  build --target avr-unknown-gnu-atmega328 -Z build-std=core --release
   Compiling critical-section v0.2.7
   Compiling atomic-polyfill v0.1.8 (/home/jeremy/apechem/atomic-polyfill)
error: cannot find macro `llvm_asm` in this scope
   --> /home/jeremy/.cargo/registry/src/github.com-1ecc6299db9ec823/critical-section-0.2.7/src/lib.rs:127:13
    |
127 |             llvm_asm!(
    |             ^^^^^^^^

error: cannot find macro `llvm_asm` in this scope
   --> /home/jeremy/.cargo/registry/src/github.com-1ecc6299db9ec823/critical-section-0.2.7/src/lib.rs:139:17
    |
139 |                 llvm_asm!("sei" :::: "volatile");
    |                 ^^^^^^^^

error[E0635]: unknown feature `llvm_asm`
 --> /home/jeremy/.cargo/registry/src/github.com-1ecc6299db9ec823/critical-section-0.2.7/src/lib.rs:3:42
  |
3 | #![cfg_attr(target_arch = "avr", feature(llvm_asm))]
  |                                          ^^^^^^^^

For more information about this error, try `rustc --explain E0635`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.