rp-rs / rp2040-pac

A Rust PAC for the RP2040 Microcontroller
145 stars 28 forks source link

Update svd2rust, svdtools #94

Open jannic opened 7 months ago

jannic commented 7 months ago

svd2rust → 0.33.0 svdtools → 0.3.12

I'm not 100% sure if adding type Safety to generic::Writable is a breaking change. Writable is a pub trait, but generic is not public, so it should be fine, I guess? At least cargo semver-checks doesn't complain.

jannic commented 7 months ago

@9names: After closer checking, even if cargo semver-checks doesn't report any issues, I'm convinced that this contains breaking changes: In fact the "Add IsEnum constraint for FieldWriters (fix variant safety)" change of svd2rust 0.33.0 does break rp2040-hal:

error[E0599]: the method `variant` exists for struct `FieldWriter<'_, CS_SPEC, 3>`, but its trait bounds were not satisfied
   --> rp2040-hal/src/adc.rs:383:39
    |
383 |             .modify(|_, w| w.ainsel().variant(pin.channel()).start_many().set_bit());
    |                                       ^^^^^^^ method cannot be called on `FieldWriter<'_, CS_SPEC, 3>` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `u8: IsEnum`
    = help: items from traits can only be used if the trait is implemented and in scope

I wonder if we should stop at svd2rust 0.32.0 for now. Would it be useful to create a 0.6.1 release before merging breaking changes?

9names commented 7 months ago

Sounds like a plan. We'll need to deal with the breakage sooner or later, but cutting a release now before doing that is a good idea.

jannic commented 7 months ago

Sounds like a plan. We'll need to deal with the breakage sooner or later, but cutting a release now before doing that is a good idea.

That would be the older pull request #93. I just updated it to include the svdtools update.

jannic commented 1 month ago

A newer version of cargo semver-checks complains on current main with:

--- failure trait_associated_type_added: non-sealed public trait added associated type without default value ---

Description:
A non-sealed trait has gained an associated type without a default value, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/trait_associated_type_added.ron

Failed in:
  trait associated type rp2040_pac::generic::Writable::Safety in file rp2040-pac/src/generic.rs:64

While I think that this is a very minor breaking change (it's quite unlikely that people try to define their own registers), it makes releasing a 0.6.1 questionable. (And if we want to, we can still do that later, based on an older commit, even if we now merge further updates to main.)