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: non-reference pattern used to match a reference (see issue #42640)
--> src/coord.rs:194:23
|
194 | .filter(|&(ref k, _)| self.hash(k) == server)
| ^^^^^^^^^^ help: consider using: `&(ref k, _)`
|
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
error: aborting due to previous error
error: Could not compile `kv_2pc`.
To learn more, run the command again with --verbose.
Specifically, notice the hint:
help: consider using: `&(ref k, _)`
which suggests doing something I am already doing 😛 ...
The code snippet in question:
fnsend_prepare(&self,server:&str,txn:TxnId,staged:&Vec<(String,String)>) -> Flags{// Only send to the server the items on that server!letmut staged = staged
.iter().filter(|&(ref k, _)| self.hash(k) == server).collect();retry_forever!{
do {// SendToServer(s, {Prepare})let server = SyncClient::connect(server, client::Options::default()).unwrap();
server.send_to_server(txn,Flags::PREPARE,Some(staged.clone()))},
retry ifErr(tarpc::Error::Io(_)),match{Ok(flags) => flags,
err => panic!("Error with (de)serialization: {:?}", err)}}}
Changing .filter(|&(ref k, _)| self.hash(k) == server) to .filter(|pair| self.hash(&pair.0) == server) sidesteps the problem.
…ielb1
Be more obvious when suggesting dereference
Include `&` span when suggesting dereference on a span that is already a reference:
```
error: non-reference pattern used to match a reference (see issue #42640)
--> dont-suggest-dereference-on-arg.rs:16:19
|
16 | .filter(|&(ref a, _)| foo(a))
| ^^^^^^^^^^^ help: consider using: `&&(ref k, _)`
|
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
```
Fix#45925.
Here is the whole error output:
Specifically, notice the hint:
which suggests doing something I am already doing 😛 ...
The code snippet in question:
Changing
.filter(|&(ref k, _)| self.hash(k) == server)
to.filter(|pair| self.hash(&pair.0) == server)
sidesteps the problem.The text was updated successfully, but these errors were encountered: