Fix: round trip name conversions on resources are not stable#1112
Merged
Conversation
The root cause was an asymmetric name conversion in the derive path. Resource bundle slots are written in config as strings like linux.i2c1, but the runtime macro was reconstructing a Rust enum variant name from that string in core/cu29_derive/src/ lib.rs:7115. For i2c1, that conversion produced I2C1, while cu_linux_resources declared the bundle variant as I2c1 in components/ res/cu_linux_resources/src/lib.rs:314. So the macro emitted LinuxResourcesId::I2C1, which does not exist. I fixed it by making resource resolution use the bundle’s declared slot names instead of guessing variant casing. The new lookup lives in core/cu29_runtime/src/resource.rs:161, bundle_resources! now carries canonical names in core/cu29_derive/src/ bundle_resources.rs:8, and cu_linux_resources now explicitly declares i2c0..2 as slot names in components/res/cu_linux_resources/ src/lib.rs:314. I also added a regression test for the exact i2c1 case in core/cu29_derive/tests/compile_pass/copper_runtime/ resource_bundle_slot_name_case.rs:1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The root cause was an asymmetric name conversion in the derive path. Resource bundle slots are written in config as strings like
linux.i2c1, but the runtime macro was reconstructing a Rust enum variant name from that string in core/cu29_derive/src/
lib.rs:7115. For i2c1, that conversion produced I2C1, while cu_linux_resources declared the bundle variant as I2c1 in components/
res/cu_linux_resources/src/lib.rs:314. So the macro emitted LinuxResourcesId::I2C1, which does not exist.
I fixed it by making resource resolution use the bundle’s declared slot names instead of guessing variant casing. The new lookup
lives in core/cu29_runtime/src/resource.rs:161, bundle_resources! now carries canonical names in core/cu29_derive/src/
bundle_resources.rs:8, and cu_linux_resources now explicitly declares i2c0..2 as slot names in components/res/cu_linux_resources/
src/lib.rs:314. I also added a regression test for the exact i2c1 case in core/cu29_derive/tests/compile_pass/copper_runtime/
resource_bundle_slot_name_case.rs:1.
Summary
Related issues
Changes
Reminder
justfrom the repo rootAdditional context