Skip to content

Conversation

@abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Aug 27, 2025

Where functions have signatures like fn foo(value: impl Into<Bson>) this enables the nice foo([1, 2, 3]) where currently it needs the awkward foo([1, 2, 3].as_ref()) or similar workaround.

For things accepting arrays, usually you can just use foo(&[1, 2, 3]) but that doesn't work here because the argument is actually of type &[i32; 3]; the compiler will coerce the ref to &[i32] only in the context of a concrete type, not when matching against trait impls :(

@abr-egn abr-egn marked this pull request as ready for review August 27, 2025 14:57
@abr-egn abr-egn requested a review from a team as a code owner August 27, 2025 14:57
@abr-egn abr-egn requested a review from isabelatkinson August 27, 2025 14:57
@abr-egn abr-egn merged commit 440bfeb into mongodb:main Aug 27, 2025
12 checks passed
@isabelatkinson isabelatkinson mentioned this pull request Nov 20, 2025
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