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

Can't build with defmt-decoder 0.3.10 #2155

Closed
tommy-gilligan opened this issue Feb 8, 2024 · 9 comments · Fixed by #2167
Closed

Can't build with defmt-decoder 0.3.10 #2155

tommy-gilligan opened this issue Feb 8, 2024 · 9 comments · Fixed by #2167
Labels
bug Something isn't working

Comments

@tommy-gilligan
Copy link
Contributor

Build fails with

error[E0603]: struct `Formatter` is private
   --> probe-rs/src/bin/probe-rs/util/rtt.rs:386:36
    |
386 |     formatter: defmt_decoder::log::Formatter,
    |                                    ^^^^^^^^^ private struct
    |
note: the struct `Formatter` is defined here
   --> /home/tom/.cargo/registry/src/index.crates.io-6f17d22bba15001f/defmt-decoder-0.3.10/src/log/mod.rs:19:14
    |
19  |     format::{Formatter, HostFormatter},
    |              ^^^^^^^^^
help: consider importing this struct instead
    |
386 |     formatter: defmt_decoder::log::format::Formatter,
    |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: import `Formatter` directly
    |
386 |     formatter: defmt_decoder::log::format::Formatter,
    |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0603]: struct `Formatter` is private
   --> probe-rs/src/bin/probe-rs/util/rtt.rs:470:53
    |
470 |                 let formatter = defmt_decoder::log::Formatter::new(format);
    |                                                     ^^^^^^^^^ private struct
    |
note: the struct `Formatter` is defined here
   --> /home/tom/.cargo/registry/src/index.crates.io-6f17d22bba15001f/defmt-decoder-0.3.10/src/log/mod.rs:19:14
    |
19  |     format::{Formatter, HostFormatter},
    |              ^^^^^^^^^
help: consider importing this struct instead
    |
470 |                 let formatter = defmt_decoder::log::format::Formatter::new(format);
    |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: import `Formatter` directly
    |
470 |                 let formatter = defmt_decoder::log::format::Formatter(format);
    |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0599]: no method named `format_to_string` found for reference `&defmt_decoder::log::format::Formatter` in the current scope
   --> probe-rs/src/bin/probe-rs/util/rtt.rs:346:43
    |
346 | ...                   formatter.format_to_string(frame, file.as_deref(), line, module);
    |                                 ^^^^^^^^^^^^^^^^ method not found in `&Formatter`

error[E0277]: `defmt_decoder::log::format::Formatter` doesn't implement `std::fmt::Debug`
   --> probe-rs/src/bin/probe-rs/util/rtt.rs:386:5
    |
382 | #[derive(Debug)]
    |          ----- in this derive macro expansion
...
386 |     formatter: defmt_decoder::log::Formatter,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `defmt_decoder::log::format::Formatter` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
    |
    = help: the trait `std::fmt::Debug` is not implemented for `defmt_decoder::log::format::Formatter`, which is required by `&defmt_decoder::log::format::Formatter: std::fmt::Debug`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
   --> probe-rs/src/bin/probe-rs/util/rtt.rs:470:68
    |
470 |                 let formatter = defmt_decoder::log::Formatter::new(format);
    |                                 ---------------------------------- ^^^^^^ expected `FormatterConfig<'_>`, found `&str`
    |                                 |
    |                                 arguments to this function are incorrect
    |
note: associated function defined here
   --> /home/tom/.cargo/registry/src/index.crates.io-6f17d22bba15001f/defmt-decoder-0.3.10/src/log/format/mod.rs:193:12
    |
193 |     pub fn new(config: FormatterConfig) -> Self {
    |            ^^^
                      ^^^^^^^^^ private struct

To Reproduce

  1. cd probe-rs
  2. cargo build --features cli

Expected behavior
Builds successfully

Desktop (please complete the following information):

$ uname -a
Linux pi5 6.1.0-rpi8-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux
@tommy-gilligan tommy-gilligan added the bug Something isn't working label Feb 8, 2024
@tommy-gilligan
Copy link
Contributor Author

We probably want to pin defmt-decoder 0.3.9 for now

tommy-gilligan added a commit to tommy-gilligan/probe-rs that referenced this issue Feb 8, 2024
@Yatekii
Copy link
Member

Yatekii commented Feb 8, 2024

We should report this as an upstream issue in https://github.com/knurling-rs/defmt too. They broke semver as it seems.

@tommy-gilligan
Copy link
Contributor Author

We should report this as an upstream issue in https://github.com/knurling-rs/defmt too.

Agreed

They broke semver as it seems.

I'm not too clear on this. I didn't have time right now to properly investigate but probe-rs is using defmt-decoder with feature unstable. I think they did still break semver but potentially they're treating stuff we're using as breakable because of the feature flag?

@tommy-gilligan
Copy link
Contributor Author

I can report to them if you'd like me to? Or I'll leave for you. Just let me know either way.

@Yatekii
Copy link
Member

Yatekii commented Feb 8, 2024

Hmm I did not consider the "unstable" flag. I find this a bit odd imo. In that case it's actually no breakage and we don't need to report 🤔
They already opened #2153.

@Cydget
Copy link

Cydget commented Feb 10, 2024

Is there a temporary bypass for this at the moment? I want to install probe-rs with ftdi feature. I was able to install it with cargo binstall , but that did not detect the ftdi probe I have.

@Cydget
Copy link

Cydget commented Feb 10, 2024

Is there a temporary bypass for this at the moment? I want to install probe-rs with ftdi feature. I was able to install it with cargo binstall , but that did not detect the ftdi probe I have.

Disregard my previous comment, doing what you said allowed me to compile from source.

We probably want to pin defmt-decoder 0.3.9 for now

@tommy-gilligan
Copy link
Contributor Author

you should be able to

cargo install probe-rs --features cli,ftdi --git https://github.com/probe-rs/probe-rs.git

although trying this just now, i get a message about ftdi not being a feature, so i'm probably doing something wrong

@Cydget
Copy link

Cydget commented Feb 10, 2024

you should be able to

cargo install probe-rs --features cli,ftdi --git https://github.com/probe-rs/probe-rs.git

although trying this just now, i get a message about ftdi not being a feature, so i'm probably doing something wrong

I'm guessing they merged it as a default feature. I was following the guide here https://probe.rs/docs/getting-started/installation/ where it said the same thing. Even without specifying the ftdi feature the debug build detected my probe where the cargo binstall version did not. Either way, im able to continue as is.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants