Skip to content

Bump defmt from 0.2.1 to 0.3 - #249

Closed
henrikssn wants to merge 1 commit into
rust-embedded:masterfrom
henrikssn:patch-1
Closed

henrikssn wants to merge 1 commit into
rust-embedded:masterfrom
henrikssn:patch-1

Conversation

@henrikssn

Copy link
Copy Markdown

No description provided.

@korken89

Copy link
Copy Markdown
Contributor

Hi, this is a breaking change - can 0.2 and 0.3 be implemented in parallel instead?

@henrikssn

Copy link
Copy Markdown
Author

Hi, this is a breaking change - can 0.2 and 0.3 be implemented in parallel instead?

I already checked the code in this repo and none of it is affected by the v0.3 changes. You can see them here: https://defmt.ferrous-systems.com/migration-02-03.html

@korken89

Copy link
Copy Markdown
Contributor

Users of this library that are still using 0.2 would see breakage, hence it is a breaking change.

@henrikssn

Copy link
Copy Markdown
Author

Users of this library that are still using 0.2 would see breakage, hence it is a breaking change.

I'm not really sure how this could be achieved since dependencies can only be specified once IIUC (so we can't have a defmt-03 feature in addition to the existing defmt-impl feature).

What would you propose?

@korken89

Copy link
Copy Markdown
Contributor

One can rename the versions of the crate, e.g. defmt v0.2 as defmt02 as described here: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml
This should work out fine.

@korken89

Copy link
Copy Markdown
Contributor

I'm testing here: https://github.com/japaric/heapless/tree/dual-defmt
For some reason this does not work, but we use the same trick in cortex-m-rtic for multiple cortex-m dependencies: https://github.com/rtic-rs/cortex-m-rtic/blob/v0.5.x/Cargo.toml#L63

Not sure what's wrong...

@korken89

Copy link
Copy Markdown
Contributor

I made a cargo issue, lets see what they say rust-lang/cargo#10066

@korken89

Copy link
Copy Markdown
Contributor

I think it is a defmt bug: knurling-rs/defmt#625

@korken89

Copy link
Copy Markdown
Contributor

In the end it's a cargo bug: rust-lang/cargo#5969

@korken89

Copy link
Copy Markdown
Contributor

We could say in the documentation that the defmt-impl flag enables the "latest" defmt release instead of a specific version.
This would allow us to update defmt in patch releases while it's still quite unstable.

@korken89

Copy link
Copy Markdown
Contributor

Another idea that I lifted in the defmt issue, use a version range:

[dependencies.defmt]
version = ">=0.2,<0.4"
optional = true

Seems to work, but I'm not sure of unintended consequences.

@korken89

Copy link
Copy Markdown
Contributor

I fixed a PR for the version range: #251

@korken89 korken89 closed this Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants