The Crate Does not Compile when the `defmt-03` Feature is Enabled
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- embedded-iot
Research direction
Reproduce the failure with cargo build --features defmt-03, then inspect the defmt::Format uses in embedded-hal/src/i2c.rs and embedded-hal/src/spi.rs. Review the proposed branch and PR #481 for the feature-resolution context; done means both embedded-hal and embedded-io compile with defmt-03 enabled.
Written by the indexing model from the issue text.
Description
Problem
Currently (on master commit 1c585d4), the crate embedded-hal and embedded-io does not compile when enabling the defmt-03 feature. The following command is run :
[./embedded-hal] $ cargo build --features defmt-03;
And these errors are returned :
Errors
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/i2c.rs:192:41
|
192 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this crate through its public re-export
|
164 + use crate::defmt;
|
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/i2c.rs:192:41
|
192 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/i2c.rs:304:41
|
304 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this crate through its public re-export
|
164 + use crate::defmt;
|
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/i2c.rs:304:41
|
304 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/spi.rs:201:41
|
201 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this crate through its public re-export
|
174 + use crate::defmt;
|
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/spi.rs:201:41
|
201 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/spi.rs:319:41
|
319 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this crate through its public re-export
|
174 + use crate::defmt;
|
error[E0433]: failed to resolve: could not find `defmt` in the list of imported crates
--> embedded-hal/src/spi.rs:319:41
|
319 | #[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
| ^^^^^^^^^^^^^ could not find `defmt` in the list of imported crates
|
= note: this error originates in the derive macro `defmt::Format` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0433`.
error: could not compile `embedded-hal` (lib) due to 8 previous errors
This is run by the following Rust version :
cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Arch Linux [64-bit]
Solution
I forked the repository and pushed a branch that successfully compiles embedded-hal and embedded-io in a standalone fashion. It is confirmed to work for our needs.
However, I know this could conflict with a previous discussion on PR https://github.com/rust-embedded/embedded-hal/pull/481.
What is happening in this case ?
Thanks for your help.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-embedded/embedded-hal
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rust-embedded/embedded-hal#742 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
rust-embedded/embedded-hal#747 · 5 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
rust-embedded/embedded-hal#746 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rust-embedded/embedded-hal#745 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
rust-embedded/embedded-hal#744 · 1 comment ·
All issues in rust-embedded/embedded-hal
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100