Skip to content

[hir-ty] Missed RPIT in ide/src/rename.rs #19439

Closed
@snprajwal

Description

@snprajwal

I've written a tool that walks the AST and resolves all exprs, collecting the types. I've tested this on other big projects in debug mode (notably rustfmt) and it works fine. Running it on rust-analyzer itself causes it to panic on line 206 in ide/src/rename.rs with Missed RPIT in `insert_inference_vars_for_rpit` .

syntax: &SyntaxNode,
FilePosition { file_id, offset }: FilePosition,
) -> RenameResult<impl Iterator<Item = (FileRange, SyntaxKind, Definition)>> {
let token = syntax.token_at_offset(offset).find(|t| matches!(t.kind(), SyntaxKind::STRING));

The error is coming from here:

if let Entry::Vacant(e) = self.result.type_of_rpit.entry(id) {
never!("Missed RPIT in `insert_inference_vars_for_rpit`");
e.insert(TyKind::Error.intern(Interner));

Not sure how to reproduce this with a test or code action. No issues in release mode since never! doesn't show up without debug assertions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bugI-panic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions