Skip to content

Broken configuration of atomics with tokio/bytes #51

@jklmnn

Description

@jklmnn

I'm currently using this crate on an rp2040 and noticed that with the latest master release here I get the following errors:

error[E0599]: no method named `fetch_add` found for reference `&AtomicUsize` in the current scope
    --> /.../.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.9.0/src/bytes.rs:1131:27
     |
1131 |     let old_cnt = ref_cnt.fetch_add(1, Ordering::Relaxed);
     |                           ^^^^^^^^^ method not found in `&AtomicUsize`

I'm using tokio-rs/bytes@16fd473 (see tokio-rs/bytes#467) and it works fine with mqttrs 0.4.1. It breaks with master and the problematic change seems to be 9f70f89 by @mchodzikiewicz. I see that there is 6e06377 but it doesn't seem to address the problem fully. Unfortunately I don't understand enough of the inner workings of Cargo to provide a fix.

My Cargo.toml is

[dependencies]
cortex-m-rt = "0.7.5"
defmt = "0.3.10"
defmt-rtt = "0.4.1"
embassy-time = "0.4.0"
static_cell = "2.1.0"
no-std-net = "0.6.0"

[dependencies.bytes]
#version = "1.9"
git = "https://github.com/tokio-rs/bytes.git"
rev = "16fd473d5c6ca20787e157ec19afc469438fc66b"
default-features = false
features = ["extra-platforms"]

[dependencies.cyw43]
version = "0.3.0"
features = ["defmt", "firmware-logs"]

[dependencies.cyw43-pio]
version = "0.3.0"
features = ["defmt"]

[dependencies.embassy-executor]
version = "0.7.0"
features = ["arch-cortex-m", "executor-thread", "defmt", "task-arena-size-16384"]

[dependencies.embassy-net]
version = "0.6.0"
features = ["defmt", "tcp", "udp", "raw", "dhcpv4", "medium-ethernet", "dns", "proto-ipv4", "proto-ipv6", "multicast"]

[dependencies.embassy-rp]
version = "0.3.0"
features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp2040"]

[dependencies.mqttrs]
#version = "0.4"
git = "https://github.com/00imvj00/mqttrs.git"
rev = "6296bab1673b9d7d316165d46e2836d03a6e5965"
default-features = false

[dependencies.panic-probe]
version = "0.3.2"
features = ["print-defmt"]

[dependencies.portable-atomic]
version = "1.10"
default-features = false
features = ["critical-section"]

[dependencies.rp2040-hal]
version = "0.11"
features = ["critical-section-impl"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions