rust-lang / rust-lang/rust-analyzer
Incorrect import suggestion when using `rhai`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Got somewhat strange behavior when working with rhai. Here's the minimal example.
Cargo.toml:
[package]
name = "quick_tests"
version = "0.1.0"
edition = "2021"
[dependencies]
rhai = "=1.16.3"
main.rs:
fn main() {
let _: Rc<RefCell<()>> = todo!();
}
This code errors as expected, but when I try to use code actions to apply auto fixes, VSCode with RA offers to auto import rhai::Shared and rhai::Locked, instead of std::rc::Rc and std::cell::RefCell. cargo check shows suggestions correctly, so it's purely rust-analyzer problem.
rust-analyzer version: 0.3.1815-standalone
rustc version: 1.75.0 (82e1608df 2023-12-21)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Cargo.toml and main.rs using rust-analyzer 0.3.1815-standalone, then inspect the auto-import code-action path. Compare its suggestions with cargo check; done means the action offers std::rc::Rc and std::cell::RefCell rather than rhai::Shared and rhai::Locked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100