Closed
Description
VSCode: 1.61.1
OS: Windows 10
Rust-analyser: 0.2.776
This code compiles, but is handled incorrectly by RA:
use std::rc::Rc;
use std::collections::HashMap;
struct DocumentData {
tables: Vec<TableData>
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TableId(usize);
struct TableData {
everything_else_hash: HashMap<String, String>
}
pub struct TableRef(Rc<DocumentData>, TableId);
impl TableRef {
pub fn get_item_bug(&self, item: &String) -> Option<String> {
let tid = self.1.0;
self.0.tables[tid].everything_else_hash.get(item).map(Clone::clone)
}
pub fn get_item_correct(&self, item: &String) -> Option<String> {
let ti = self.1;
let tid = ti.0;
self.0.tables[tid].everything_else_hash.get(item).map(Clone::clone)
}
}
Specifically, in get_item_bug
:
- Tooltip of
tid
readslet tid: Rc<DocumentData>
(should beusize
) everything_else_hash
andget
are displayed with the "nonexistent item" formatting (should be field and method respectively)- Their tooltips read
{unknown}
and highlight the entire line up to that point. map
is incorrectly listed as beingIterator::map
rather thanOption::map
None of get_item_correct
has this, nor does rustc itself report any errors