ref(managed): Add Managed::zip function#6088
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c1e3f13. Configure here.
|
Alright I got the main pipelines to pass @Dav1dde and I made the changes. Let me know what you think! Thanks. https://github.com/getsentry/relay/actions/runs/27785392311/job/82223873618?pr=6088#step:7:166 |
Dav1dde
left a comment
There was a problem hiding this comment.
Thanks, looks great!
Documenting the behaviour of what happens to the meta is important to me to make it clear it's not an oversight or "random", the debug_assert is useful because we should never merge two Managed instances from different origins.
|
Changed the title to make the CI check happy |
…or scoping check, update name for new tests.
|
@Dav1dde , I believe I have added the assert check and a test. Give it another look and let me know! Thanks. |
| where | ||
| S: Counted, | ||
| { | ||
| assert!( |
There was a problem hiding this comment.
We basically only do debug_assert!'s in this module, would stick to the same pattern here.
There was a problem hiding this comment.
Sounds good, I can change this.
| first | ||
| .meta | ||
| .as_ref() | ||
| .scoping | ||
| .eq(&second.meta.as_ref().scoping), | ||
| "cannot zip Managed values with different metadata" | ||
| ); |
There was a problem hiding this comment.
Untested, shouldn't debug_assert_eq!(first.scoping(), second.scoping()) work here?
There was a problem hiding this comment.
I'll try it. But yes, probably. Simpler is usually better 😄
Dav1dde
left a comment
There was a problem hiding this comment.
Thanks! I think only a make format is missing before CI is happy.
|
Yeah super weird, I think the rust-analyzer locally is conflicting with the |

#5985
Added a generic Managed::merge helper that consumes two managed values and returns a single Managed<(T, S)>,
transferring outcome responsibility into the merged wrapper while preserving metadata from the first value.
Also added a unit test covering the new behavior: the merged value retains both inner values, emits outcomes
for both through the first managed handle when dropped, and prevents the second managed value from emitting
duplicate outcomes after the merge.
I also ran:
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.