Rename on an imported type should rename the import to an alias.
Author: dfireBirdCreated Sep 11, 2026Updated Sep 15, 2026
LabelsA-assistsC-feature
I'm not sure if this is valid request, but please feel free to close it, if it is.
When I tried to rename an imported type, hoping it will rename it to an alias, but it just returned an error: "Can't rename non-local definition". But when I searched, I found that rename will alias an import, if we are in the use tree when invoking it, so I was wondering if we could extend to any imported type or the at least non-local crate imports?
Simple example:
use std::collections::HashMap
struct Foo {
map: HashMap$0,
}Invoking rename on the cursor should create an alias import:
use std::collections::HashMap as StdHashMap;
struct Foo {
map: StdHashMap$0,
}Source: rust-lang/rust-analyzer