rust-lang / rust-lang/rust-analyzer
Panic while trying to inline type alias
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.4.2587-standalone [/home/bjorn/.vscode/extensions/rust-lang.rust-analyzer-0.4.2587-linux-x64/server/rust-analyzer]
rustc version: rustc 1.90.0-nightly (adcb3d3b4 2025-07-31)
editor or extension: VSCode
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
This is for a project that is not yet open source. If necessary I can try to make a minimal reproducer later.
thread 'Worker3' panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rowan-0.15.15/src/ast.rs:73:50:
can't resolve SyntaxNodePtr { kind: USE_TREE, range: 462..470 } with SOURCE_FILE@0..457173
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: rowan::ast::SyntaxNodePtr<L>::to_node
3: ide_db::source_change::TreeMutator::make_syntax_mut
4: ide_db::source_change::SourceChangeBuilder::make_mut
5: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::fold
6: itertools::Itertools::partition_map
7: ide_assists::handlers::inline_call::split_refs_and_uses
8: ide_assists::assist_context::Assists::add::{{closure}}
9: ide_assists::assist_context::Assists::add_impl
10: ide_assists::assist_context::Assists::add
11: ide_assists::handlers::inline_type_alias::inline_type_alias_uses
12: ide_assists::assists
13: salsa::cancelled::Cancelled::catch
14: std::thread::local::LocalKey<T>::with
15: ide::Analysis::assists_with_fixes
16: rust_analyzer::handlers::request::handle_code_action_resolve
17: core::ops::function::FnOnce::call_once{{vtable.shim}}
18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stacktrace:
additional context:
0:
version: 0.4.2587-standalone
request: codeAction/resolve CodeAction {
title: "Inline type alias into all uses",
group: None,
kind: Some(
CodeActionKind(
"refactor.inline",
),
),
command: None,
edit: None,
is_preferred: None,
data: Some(
CodeActionData {
code_action_params: CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "<censored>",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 38,
character: 10,
},
end: Position {
line: 38,
character: 10,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
trigger_kind: Some(
Invoked,
),
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
},
id: "inline_type_alias_uses:RefactorInline:0:",
version: Some(
18,
),
},
),
}
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
Start by examining the reported stack through ide_assists::handlers::inline_type_alias, inline_call::split_refs_and_uses, and ide_db::source_change::TreeMutator, with the rowan AST panic as the failure point. Reproduce the inline type alias code action if possible; done means the action no longer panics when resolving the reported USE_TREE node.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100