Skip to content

Panic: mismatched kinds in substitution in textDocument/references #19610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
minestarks opened this issue Apr 16, 2025 · 1 comment · Fixed by #19612
Closed

Panic: mismatched kinds in substitution in textDocument/references #19610

minestarks opened this issue Apr 16, 2025 · 1 comment · Fixed by #19612
Assignees
Labels
C-bug Category: bug

Comments

@minestarks
Copy link
Contributor

minestarks commented Apr 16, 2025

This occurs persistently in many different spots in our repo, always in textDocument/references. See below for one specific example.

rust-analyzer version: 0.3.2379-standalone (8365cf8 2025-04-13)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: VS Code Version: 1.99.2
rust-analyzer extension 0.3.2379

relevant settings:

Using GitHub Codespaces

$ echo $RUSTUP_HOME
/usr/local/rustup
$ echo $CARGO_HOME
/usr/local/cargo

repository link: https://github.com/microsoft/qsharp

to reproduce:

  1. clone repo (I used main, commit 1778307756977cc846421d80ab66b4f77e7c39ee which is tip as of 4/16/2025)
  2. cargo build
  3. Open compiler/qsc_qasm3/src/lib.rs in VS Code
  4. "Go to References" (shift-F12) on line 57 (ErrorKind)

Error dialog shows:

Request textDocument/references failed.

Output window ("RA_LOG": "info" and LSP logs enabled)

2025-04-16T18:56:13.503557137Z  INFO handle_references:find_all_refs:FindUsages:search:NameRefClass::classify{name_ref=NameRef { syntax: [email protected] }}:SemanticsImpl::analyze_impl: infer_shim(Id(87b41)): executing query
Panic context:
> 
version: 0.3.2379-standalone (8365cf853e 2025-04-13)
request: textDocument/references ReferenceParams {
    text_document_position: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/workspaces/qsharp/compiler/qsc_qasm3/src/lib.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 56,
            character: 16,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    context: ReferenceContext {
        include_declaration: true,
    },
}


thread 'Worker' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.100.0/src/fold/subst.rs:59:22:
mismatched kinds in substitution
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 6:56:13 PM] Request textDocument/references failed.
  Message: request handler panicked: mismatched kinds in substitution
  Code: -32603 
@ChayimFriedman2
Copy link
Contributor

I put a PR with a fix. For what it's worth, the bug is not specific to references search: it is just more likely to trigger it. If you will navigate to resource_estimator/src/estimates/physical_estimation.rs you will see a lot of requests are failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants