Skip to content

panic; highlight: has parameters, but no args were provided in instantiate #23125

Description

@matthiaskrgr
use std::fmt::Debug;

trait Foo {
    type Item: Debug;
}

#[derive(Debug)]
pub struct S<T>;

pub struct S2;

impl Foo for S2 {
    type Item = impl Debug;

    fn foo<T: Debug>(_: T) -> Self::Item {
        S::<T>
    }
}

rust-analyzer highlight < code.rs

thread 'main' (593978) panicked at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ra-ap-rustc_type_ir-0.166.0/src/binder.rs:654:13:
S<#0> has parameters, but no args were provided in instantiate
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/12c36e2539c54397c51d6ea4401defd8768a4f5b/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/12c36e2539c54397c51d6ea4401defd8768a4f5b/library/core/src/panicking.rs:80:14
   2: <hir_ty::infer::InferenceContext>::compute_definition_site_hidden_types
   3: <hir_ty::infer::InferenceContext>::handle_opaque_type_uses
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer/opaques.rs:30:14
   4: hir_ty::infer::infer_finalize
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:244:9
   5: hir_ty::infer::infer_query_with_inspect
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:186:5
   6: hir_ty::infer::infer_query
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:123:5
   7: <hir_ty::infer::InferenceResult as <hir_ty::infer::InferenceResult>::for_body::InnerTrait_>::for_body_
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:1086:9
   8: <<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_ as salsa::function::Configuration>::execute::inner_
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:1082:1
   9: <<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_ as salsa::function::Configuration>::execute
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-macro-rules-0.28.2/src/setup_tracked_fn.rs:350:21
  10: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute_query
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/execute.rs:335:25
  11: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute_maybe_iterate
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/execute.rs:179:49
  12: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/execute.rs:73:22
  13: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::fetch_cold
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/fetch.rs:157:14
  14: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::refresh_memo
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/fetch.rs:69:38
  15: <salsa::function::IngredientImpl<<hir_ty::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::fetch
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/function/fetch.rs:29:25
  16: <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-macro-rules-0.28.2/src/setup_tracked_fn.rs:110:66
  17: <salsa::attach::Attached>::attach::<dyn hir_ty::db::HirDatabase, &hir_ty::infer::InferenceResult, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/attach.rs:88:9
  18: salsa::attach::attach::<&hir_ty::infer::InferenceResult, dyn hir_ty::db::HirDatabase, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>::{closure#0}
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/attach.rs:178:15
  19: <std::thread::local::LocalKey<salsa::attach::Attached>>::try_with::<salsa::attach::attach<&hir_ty::infer::InferenceResult, dyn hir_ty::db::HirDatabase, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>::{closure#0}, &hir_ty::infer::InferenceResult>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:464:12
  20: <std::thread::local::LocalKey<salsa::attach::Attached>>::with::<salsa::attach::attach<&hir_ty::infer::InferenceResult, dyn hir_ty::db::HirDatabase, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>::{closure#0}, &hir_ty::infer::InferenceResult>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:428:20
  21: salsa::attach::attach::<&hir_ty::infer::InferenceResult, dyn hir_ty::db::HirDatabase, <hir_ty::infer::InferenceResult>::for_body::for_body_::{closure#0}>
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/attach.rs:176:14
  22: <hir_ty::infer::InferenceResult>::for_body::for_body_
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-macro-rules-0.28.2/src/setup_tracked_fn.rs:100:13
  23: <hir_ty::infer::InferenceResult>::for_body
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:1082:1
  24: <hir_ty::infer::InferenceResult>::of::<hir_def::DefWithBodyId>
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/infer.rs:1107:47
  25: <hir::semantics::SemanticsImpl>::with_all_infers_for_store
             at /home/matthias/vcs/github/rust-analyzer/crates/hir/src/semantics.rs:2255:26
  26: <hir::semantics::SemanticsImpl>::get_unsafe_ops
             at /home/matthias/vcs/github/rust-analyzer/crates/hir/src/semantics.rs:1981:14
  27: ide::syntax_highlighting::traverse::{closure#2}
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/syntax_highlighting.rs:430:41
  28: <std::collections::hash::map::Entry<hir::ExpressionStoreOwner, std::collections::hash::set::HashSet<hir_expand::files::InFileWrapper<hir_expand::HirFileId, syntax::ptr::AstPtr<either::Either<syntax::ast::generated::nodes::Expr, syntax::ast::generated::nodes::Pat>>>, rustc_hash::FxBuildHasher>>>::or_insert_with::<ide::syntax_highlighting::traverse::{closure#2}>::{closure#0}
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:2541:55
  29: <std::collections::hash::map::Entry<hir::ExpressionStoreOwner, std::collections::hash::set::HashSet<hir_expand::files::InFileWrapper<hir_expand::HirFileId, syntax::ptr::AstPtr<either::Either<syntax::ast::generated::nodes::Expr, syntax::ast::generated::nodes::Pat>>>, rustc_hash::FxBuildHasher>>>::or_try_insert_with::<<std::collections::hash::map::Entry<hir::ExpressionStoreOwner, std::collections::hash::set::HashSet<hir_expand::files::InFileWrapper<hir_expand::HirFileId, syntax::ptr::AstPtr<either::Either<syntax::ast::generated::nodes::Expr, syntax::ast::generated::nodes::Pat>>>, rustc_hash::FxBuildHasher>>>::or_insert_with<ide::syntax_highlighting::traverse::{closure#2}>::{closure#0}, !>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:2576:46
  30: <std::collections::hash::map::Entry<hir::ExpressionStoreOwner, std::collections::hash::set::HashSet<hir_expand::files::InFileWrapper<hir_expand::HirFileId, syntax::ptr::AstPtr<either::Either<syntax::ast::generated::nodes::Expr, syntax::ast::generated::nodes::Pat>>>, rustc_hash::FxBuildHasher>>>::or_insert_with::<ide::syntax_highlighting::traverse::{closure#2}>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:2541:14
  31: ide::syntax_highlighting::traverse
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/syntax_highlighting.rs:430:18
  32: ide::syntax_highlighting::highlight
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/syntax_highlighting.rs:222:5
  33: ide::syntax_highlighting::html::highlight_as_html_with_config
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/syntax_highlighting/html.rs:34:21
  34: ide::syntax_highlighting::html::highlight_as_html
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/syntax_highlighting/html.rs:60:5
  35: <ide::Analysis>::highlight_as_html::{closure#0}
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/lib.rs:778:27
  36: <ide::Analysis>::with_db::<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}::{closure#0}
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/lib.rs:975:70
  37: std::panicking::catch_unwind::do_call::<<ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}::{closure#0}, alloc::string::String>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:576:43
  38: std::panicking::catch_unwind::<alloc::string::String, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}::{closure#0}>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:544:19
  39: std::panic::catch_unwind::<<ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}::{closure#0}, alloc::string::String>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  40: <salsa::cancelled::Cancelled>::catch::<<ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}::{closure#0}, alloc::string::String>
             at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/cancelled.rs:36:15
  41: <ide::Analysis>::with_db::<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/lib.rs:975:50
  42: <hir_ty::next_solver::interner::tls_db::Attached>::attach_allow_change::<core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}>
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:2482:13
  43: hir_ty::next_solver::interner::tls_db::attach_db_allow_change::<core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}>::{closure#0}
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:2505:46
  44: <std::thread::local::LocalKey<hir_ty::next_solver::interner::tls_db::Attached>>::try_with::<hir_ty::next_solver::interner::tls_db::attach_db_allow_change<core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}>::{closure#0}, core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:464:12
  45: <std::thread::local::LocalKey<hir_ty::next_solver::interner::tls_db::Attached>>::with::<hir_ty::next_solver::interner::tls_db::attach_db_allow_change<core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}>::{closure#0}, core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>>
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:428:20
  46: hir_ty::next_solver::interner::tls_db::attach_db_allow_change::<core::result::Result<alloc::string::String, salsa::cancelled::Cancelled>, <ide::Analysis>::with_db<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>::{closure#0}>
             at /home/matthias/vcs/github/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:2505:19
  47: <ide::Analysis>::with_db::<<ide::Analysis>::highlight_as_html::{closure#0}, alloc::string::String>
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/lib.rs:975:9
  48: <ide::Analysis>::highlight_as_html
             at /home/matthias/vcs/github/rust-analyzer/crates/ide/src/lib.rs:778:14
  49: <rust_analyzer::cli::flags::Highlight>::run
             at /home/matthias/vcs/github/rust-analyzer/crates/rust-analyzer/src/cli/highlight.rs:13:29
  50: rust_analyzer::actual_main
             at /home/matthias/vcs/github/rust-analyzer/crates/rust-analyzer/src/bin/main.rs:73:55
  51: rust_analyzer::main
             at /home/matthias/vcs/github/rust-analyzer/crates/rust-analyzer/src/bin/main.rs:32:9
  52: <fn() -> core::result::Result<std::process::ExitCode, anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

rust-analyzer 0.0.0 (67e3c11255 2026-08-11)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions