Skip to content

panicked at 'mismatched kinds in substitution' #11835

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
feldroop opened this issue Mar 28, 2022 · 1 comment · Fixed by #11840
Closed

panicked at 'mismatched kinds in substitution' #11835

feldroop opened this issue Mar 28, 2022 · 1 comment · Fixed by #11840
Labels
A-ty type system / type inference / traits / method resolution Broken Window Bugs / technical debt to be addressed immediately

Comments

@feldroop
Copy link

Background

I use the VSCode rust-analyzer extension with version v0.3.992 Pre-Release. I tried switching to release version, this didn't fix my problem. You can find the code I am currently working with here: https://github.com/Felix-Droop/brute1000

I already found a similar and closed issue here: #11717
But I think my version is recent enough such that this should not be the exact same problem (not completely sure though).

rust-analyzer version: rust-analyzer version: bc08b8e 2022-03-28 nightly

rustc version: rustc 1.59.0 (9d1b2106e 2022-02-23)

relevant settings: Should all be default^^

My problem

I get error messages from VSCode for some editing actions I do. The messages say the following:
Request textDocument/semanticTokens/full/delta failed.
Request textDocument/hover failed.
Request textDocument/signatureHelp failed.

One example of how I get the error is removing the comments here (inside VSCode using Ctrl+#): https://github.com/Felix-Droop/brute1000/blob/master/src/main.rs#L25-L35

As expected by the error messages, I get no code coloring, no hover help, etc. (for this block; for other parts of the code it works). In the following I will post the one examplary output from the VSCode Output field for the error messages:

Output

[Error - 15:24:06] Request textDocument/semanticTokens/full/delta failed.
  Message: server panicked: mismatched kinds in substitution
  Code: -32603 
Panic context:
> 
version: bc08b8eff 2022-03-28 nightly
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/.../brute1000/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 24,
            character: 0,
        },
        end: Position {
            line: 34,
            character: 5,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread '<unnamed>' panicked at 'mismatched kinds in substitution', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\chalk-ir-0.81.0\src\fold\subst.rs:109:22
stack backtrace:
   0: std::panicking::begin_panic
   1: <chalk_ir::fold::subst::Subst<I> as chalk_ir::fold::Folder<I>>::fold_free_var_const
   2: <chalk_ir::Const<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   3: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   4: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::WhereClause<I>>::fold_with
   5: chalk_ir::fold::binder_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Binders<T>>::fold_with
   6: chalk_ir::Binders<T>::substitute
   7: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
   8: <chalk_solve::rust_ir::OpaqueTyDatum<I> as chalk_solve::clauses::program_clauses::ToProgramClauses<I>>::to_program_clauses
   9: chalk_solve::clauses::program_clauses_that_could_match
  10: chalk_recursive::solve::SolveIteration::solve_iteration
  11: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  12: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
  13: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
  14: salsa::runtime::Runtime::execute_query_implementation
  15: salsa::derived::slot::Slot<Q,MP>::read
  16: salsa::derived::slot::Slot<Q,MP>::read
  17: salsa::QueryTable<Q>::get
  18: <DB as hir_ty::db::HirDatabase>::trait_solve_query
  19: hir_ty::db::trait_solve_wait
  20: <DB as hir_ty::db::HirDatabase>::trait_solve
  21: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
  22: hir_ty::infer::InferenceContext::insert_type_vars_shallow
  23: chalk_solve::display::state::WriterState<I,DB,P>::new
  24: chalk_solve::display::state::WriterState<I,DB,P>::new
  25: hir_def::intern::Interned<T>::new
  26: chalk_solve::display::state::WriterState<I,DB,P>::new
  27: chalk_solve::display::state::WriterState<I,DB,P>::new
  28: hir_ty::infer::infer_query
  29: salsa::runtime::Runtime::execute_query_implementation
  30: salsa::derived::slot::Slot<Q,MP>::read
  31: salsa::derived::slot::Slot<Q,MP>::read
  32: salsa::QueryTable<Q>::get
  33: <DB as hir_ty::db::HirDatabase>::infer_query
  34: hir_ty::db::infer_wait
  35: hir::DefWithBody::diagnostics
  36: hir::ModuleDef::diagnostics
  37: hir::Module::diagnostics
  38: ide_diagnostics::diagnostics
  39: std::panicking::try
  40: rust_analyzer::handlers::handle_code_action
  41: std::panicking::try
  42: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: bc08b8eff 2022-03-28 nightly
request: experimental/inlayHints InlayHintsParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/.../brute1000/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Some(
        Range {
            start: Position {
                line: 0,
                character: 0,
            },
            end: Position {
                line: 100,
                character: 1,
            },
        },
    ),
}

thread '<unnamed>' panicked at 'mismatched kinds in substitution', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\chalk-ir-0.81.0\src\fold\subst.rs:109:22
stack backtrace:
   0: std::panicking::begin_panic
   1: <chalk_ir::fold::subst::Subst<I> as chalk_ir::fold::Folder<I>>::fold_free_var_const
   2: <chalk_ir::Const<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   3: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   4: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::WhereClause<I>>::fold_with
   5: chalk_ir::fold::binder_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Binders<T>>::fold_with
   6: chalk_ir::Binders<T>::substitute
   7: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
   8: <chalk_solve::rust_ir::OpaqueTyDatum<I> as chalk_solve::clauses::program_clauses::ToProgramClauses<I>>::to_program_clauses
   9: chalk_solve::clauses::program_clauses_that_could_match
  10: chalk_recursive::solve::SolveIteration::solve_iteration
  11: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  12: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
  13: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
  14: salsa::runtime::Runtime::execute_query_implementation
  15: salsa::derived::slot::Slot<Q,MP>::read
  16: salsa::derived::slot::Slot<Q,MP>::read
  17: salsa::QueryTable<Q>::get
  18: <DB as hir_ty::db::HirDatabase>::trait_solve_query
  19: hir_ty::db::trait_solve_wait
  20: <DB as hir_ty::db::HirDatabase>::trait_solve
  21: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
  22: hir_ty::infer::InferenceContext::insert_type_vars_shallow
  23: chalk_solve::display::state::WriterState<I,DB,P>::new
  24: chalk_solve::display::state::WriterState<I,DB,P>::new
  25: hir_def::intern::Interned<T>::new
  26: chalk_solve::display::state::WriterState<I,DB,P>::new
  27: chalk_solve::display::state::WriterState<I,DB,P>::new
  28: hir_ty::infer::infer_query
  29: salsa::runtime::Runtime::execute_query_implementation
  30: salsa::derived::slot::Slot<Q,MP>::read
  31: salsa::derived::slot::Slot<Q,MP>::read
  32: salsa::QueryTable<Q>::get
  33: <DB as hir_ty::db::HirDatabase>::infer_query
  34: hir_ty::db::infer_wait
  35: hir::source_analyzer::SourceAnalyzer::new_for_body
  36: hir::semantics::SemanticsImpl::analyze_impl
  37: ide::inlay_hints::hints
  38: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  39: ide::inlay_hints::inlay_hints
  40: std::panicking::try
  41: ide::Analysis::inlay_hints
  42: rust_analyzer::handlers::handle_inlay_hints
  43: std::panicking::try
  44: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: bc08b8eff 2022-03-28 nightly
request: experimental/inlayHints InlayHintsParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/.../brute1000/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Some(
        Range {
            start: Position {
                line: 0,
                character: 0,
            },
            end: Position {
                line: 61,
                character: 13,
            },
        },
    ),
}

thread '<unnamed>' panicked at 'mismatched kinds in substitution', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\chalk-ir-0.81.0\src\fold\subst.rs:109:22
stack backtrace:
   0: std::panicking::begin_panic
   1: <chalk_ir::fold::subst::Subst<I> as chalk_ir::fold::Folder<I>>::fold_free_var_const
   2: <chalk_ir::Const<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   3: <chalk_ir::Ty<I> as chalk_ir::fold::SuperFold<I>>::super_fold_with
   4: chalk_ir::_::<impl chalk_ir::fold::Fold<I> for chalk_ir::WhereClause<I>>::fold_with
   5: chalk_ir::fold::binder_impls::<impl chalk_ir::fold::Fold<I> for chalk_ir::Binders<T>>::fold_with
   6: chalk_ir::Binders<T>::substitute
   7: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
   8: <chalk_solve::rust_ir::OpaqueTyDatum<I> as chalk_solve::clauses::program_clauses::ToProgramClauses<I>>::to_program_clauses
   9: chalk_solve::clauses::program_clauses_that_could_match
  10: chalk_recursive::solve::SolveIteration::solve_iteration
  11: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  12: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
  13: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
  14: salsa::runtime::Runtime::execute_query_implementation
  15: salsa::derived::slot::Slot<Q,MP>::read
  16: salsa::derived::slot::Slot<Q,MP>::read
  17: salsa::QueryTable<Q>::get
  18: <DB as hir_ty::db::HirDatabase>::trait_solve_query
  19: hir_ty::db::trait_solve_wait
  20: <DB as hir_ty::db::HirDatabase>::trait_solve
  21: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
  22: hir_ty::infer::InferenceContext::insert_type_vars_shallow
  23: chalk_solve::display::state::WriterState<I,DB,P>::new
  24: chalk_solve::display::state::WriterState<I,DB,P>::new
  25: hir_def::intern::Interned<T>::new
  26: chalk_solve::display::state::WriterState<I,DB,P>::new
  27: chalk_solve::display::state::WriterState<I,DB,P>::new
  28: hir_ty::infer::infer_query
  29: salsa::runtime::Runtime::execute_query_implementation
  30: salsa::derived::slot::Slot<Q,MP>::read
  31: salsa::derived::slot::Slot<Q,MP>::read
  32: salsa::QueryTable<Q>::get
  33: <DB as hir_ty::db::HirDatabase>::infer_query
  34: hir_ty::db::infer_wait
  35: hir::source_analyzer::SourceAnalyzer::new_for_body
  36: hir::semantics::SemanticsImpl::analyze_impl
  37: ide::inlay_hints::hints
  38: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  39: ide::inlay_hints::inlay_hints
  40: std::panicking::try
  41: ide::Analysis::inlay_hints
  42: rust_analyzer::handlers::handle_inlay_hints
  43: std::panicking::try
  44: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@Veykril Veykril added A-ty type system / type inference / traits / method resolution Broken Window Bugs / technical debt to be addressed immediately labels Mar 28, 2022
@bors bors bot closed this as completed in 89d495e Mar 29, 2022
@feldroop
Copy link
Author

feldroop commented Mar 29, 2022

Thanks for the quick fix!
BTW, I think this software is amazing and makes for a great developing experience! It suddenly not working flawlessly made me realize how much I rely upon it. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution Broken Window Bugs / technical debt to be addressed immediately
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants