mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Fix overloaded deref unused mut false positive
This commit is contained in:
parent
6377d50bd1
commit
bf0f99f15d
3 changed files with 45 additions and 6 deletions
|
@ -263,12 +263,14 @@ impl Evaluator<'_> {
|
|||
for proj in &p.projection {
|
||||
match proj {
|
||||
ProjectionElem::Deref => {
|
||||
match &ty.data(Interner).kind {
|
||||
TyKind::Ref(_, _, inner) => {
|
||||
ty = inner.clone();
|
||||
ty = match &ty.data(Interner).kind {
|
||||
TyKind::Raw(_, inner) | TyKind::Ref(_, _, inner) => inner.clone(),
|
||||
_ => {
|
||||
return Err(MirEvalError::TypeError(
|
||||
"Overloaded deref in MIR is disallowed",
|
||||
))
|
||||
}
|
||||
_ => not_supported!("dereferencing smart pointers"),
|
||||
}
|
||||
};
|
||||
let x = from_bytes!(usize, self.read_memory(addr, self.ptr_size())?);
|
||||
addr = Address::from_usize(x);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue