winksaville / exper_inter_process_channel

Experiment with inter-process channels
MIT License
0 stars 0 forks source link

Rust-Analyzer is reporting a false `type-mismatch` error #14

Open winksaville opened 1 year ago

winksaville commented 1 year ago

I'm using vscode and I have a situation where code that compiles and runs fine, but Rust Analyzer is reporting an error, type-mismatch. This happens both on nightly and stable.

This happens at call sites "using" sender_map_insert. So there are no errors in sender_map_by_instance_id/src/lib.rs where sender_map_insert is defined, but RA reports the false error in all other cases below. By default this workspace is compiled with nightly, you can change rust-toolchain.toml to stable and the false error occurs in both cases. (When changing to stable you'll need disable the first line in /msg_header/src/lib.rs #![feature(downcast_unchecked)] // Disable if stable)

$ rg sender_map_insert
msg_header/src/lib.rs
13:// reporting a false error for sender_map_insert.

client/src/lib.rs
22:use sender_map_by_instance_id::{sender_map_get, sender_map_insert};
149:        sender_map_insert(&this.instance_id, &this.chnl.sender.clone());
315:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);
363:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);
392:        sender_map_insert(&srvr_instance_id, &srvr_chnl.sender);

con_mgr/src/lib.rs
18:use sender_map_by_instance_id::sender_map_insert;
168:        sender_map_insert(&this.instance_id, &this.chnl.sender);
389:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);
512:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);

actor_executor/src/lib.rs
22:use sender_map_by_instance_id::{sender_map_get, sender_map_insert};
116:            sender_map_insert(&ae.instance_id, &ae_chnl_sender);
282:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);

sender_map_by_instance_id/src/lib.rs
16:pub fn sender_map_insert(instance_id: &AnId, sender: &ActorSender) {
19:        println!("sender_map_insert: instance_id: {}", instance_id);
43:    // Test that the sender_map_insert and sender_map_get functions work.
49:        sender_map_insert(&instance_id, &ac.sender);

server/src/lib.rs
12:use sender_map_by_instance_id::sender_map_insert;
122:        sender_map_insert(&this.instance_id, &this.chnl.sender);
227:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);
352:        sender_map_insert(&supervisor_instance_id, &supervisor_chnl.sender);
wink@3900x 23-04-06T00:48:53.369Z:~/prgs/rust/myrepos/exper_inter_process_channel (main)
winksaville commented 1 year ago

Rust-Analyzer repo