Skip to content

Conversation

patrickfreed
Copy link
Contributor

RUST-882

This is the 1.2.x backport fix of RUST-882.

/// Note: due to https://github.com/rust-lang/rust/issues/39935 we cannot deprecate this implementation.
fn from(a: u64) -> Bson {
Bson::Int64(a as i64)
Bson::Int64(a.try_into().unwrap_or(i64::MAX))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for lack of a better option, I tried to make this "less bad", but short of panicking I'm not sure we have any other choice. I'm hesitant to panic given that we can't even deprecate this impl though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that this is the less-bad option.

/// Note: due to https://github.com/rust-lang/rust/issues/39935 we cannot deprecate this implementation.
fn from(a: u64) -> Bson {
Bson::Int64(a as i64)
Bson::Int64(a.try_into().unwrap_or(i64::MAX))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that this is the less-bad option.

@patrickfreed patrickfreed force-pushed the RUST-882/fix-lossy-1.2.x branch from 74f8dbf to 21b5ec5 Compare July 23, 2021 16:27
@patrickfreed patrickfreed merged commit e81ffef into mongodb:1.2.x Jul 23, 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.

3 participants