rust-analyzer resolves incorrectly types when using std::sync::Weak::upgrade (the resulting type is shown as Arc<{unknown}>. This cause E0107 when calling upgrade() on a Weak<RwLock<T>> and std::io::Write is in the scope, and RwLock::write() is called on the upgraded Arc.
This does not happen with std::rc::Weak.
In both case, cargo check returns without any error.
rust-analyzer version: rust-analyzer version: 0.3.2887-standalone (f04c372 2026-05-03)
rustc version: rustc 1.97.0-nightly (e95e73209 2026-05-05)
editor or extension: VSCode v1.118.1 + rust-analyzer v0.3.2887
relevant settings: rust-analyzer extension settings:
{
"rust-analyzer.cargo.targetDir": "${workspaceFolder}/target/rust-analyzer",
"rust-analyzer.hover.actions.references.enable": true,
"rust-analyzer.restartServerOnConfigChange": true,
"rust-analyzer.testExplorer": true,
"rust-analyzer.assist.emitMustUse": true,
"rust-analyzer.server.extraEnv": {
"CMAKE_GENERATOR": "Ninja"
},
"rust-analyzer.cargo.extraEnv": {
"CMAKE_GENERATOR": "Ninja"
}
}
code snippet to reproduce:
use std::sync::Weak;
// use std::rc::Weak;
use std::io::Write;
use std::sync::RwLock;
fn main() {
let t : Weak<RwLock<()>> = Weak::new();
if let Some(x) = t.upgrade() {
// r-a shows error E0107 here (expected 1 argument, found 0)
// If std::rc::Weak is used instead, r-a shows no error
let _unused = x.write();
}
}
rust-analyzer resolves incorrectly types when using
std::sync::Weak::upgrade(the resulting type is shown asArc<{unknown}>. This cause E0107 when callingupgrade()on aWeak<RwLock<T>>andstd::io::Writeis in the scope, andRwLock::write()is called on the upgradedArc.This does not happen with
std::rc::Weak.In both case,
cargo checkreturns without any error.rust-analyzer version: rust-analyzer version: 0.3.2887-standalone (f04c372 2026-05-03)
rustc version: rustc 1.97.0-nightly (e95e73209 2026-05-05)
editor or extension: VSCode v1.118.1 + rust-analyzer v0.3.2887
relevant settings: rust-analyzer extension settings:
{ "rust-analyzer.cargo.targetDir": "${workspaceFolder}/target/rust-analyzer", "rust-analyzer.hover.actions.references.enable": true, "rust-analyzer.restartServerOnConfigChange": true, "rust-analyzer.testExplorer": true, "rust-analyzer.assist.emitMustUse": true, "rust-analyzer.server.extraEnv": { "CMAKE_GENERATOR": "Ninja" }, "rust-analyzer.cargo.extraEnv": { "CMAKE_GENERATOR": "Ninja" } }code snippet to reproduce: