You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0382]: use of moved value: `session`
--> file.rs:21:48
|
11 | session: &mut ClientSession,
| ------- move occurs because `session` has type `&mut mongodb::ClientSession`, which does not implement the `Copy` trait
...
20 | let supply = col.find_one(doc! {}).session(session).await;
| ------- value moved here
21 | let supply = col.find_one(doc! {}).session(session).await;
| ^^^^^^^ value used here after move
What is the expected behavior and what is actually happening? I would expect to be able to use the session on multiple queries, but due to the Into semantics, Rust thinks the .session(...) method is moving the session.
Do you have any particular output that demonstrates this problem? N/A
Do you have any ideas on why this may be happening that could give us a
clue in the right direction? Example illustrates why this is happening, and one potential fix.
Did this issue arise out of nowhere, or after an update (of the driver,
server, and/or Rust)? After switching to the main branch.
The text was updated successfully, but these errors were encountered:
Using Into<&mut ClientSession> is needed here because there are different ClientSession types for the async and sync APIs, and this method needs to accept both. Unfortunately, this means that the Rust compiler will no longer insert an implicit reborrow of the reference, so explicit reborrows are required:
Versions/Environment
cargo pkgid mongodb
&cargo pkgid bson
) main branchdb.version()
) N/ADescribe the bug
A clear and concise description of what the bug is.
After switching to the main branch, I can no longer use session on two separate
For reference, I can get this to work
but I can reproduce the error with this
BE SPECIFIC:
Into
semantics, Rust thinks the.session(...)
method is moving the session.clue in the right direction? Example illustrates why this is happening, and one potential fix.
server, and/or Rust)? After switching to the main branch.
The text was updated successfully, but these errors were encountered: