-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugI-panic
Description
trait MapLookup<Q> {
type MapValue;
}
impl<K> MapLookup<K> for K {
type MapValue = K;
}
trait Map: MapLookup<<Self as Map>::Key> {
type Key;
}
impl<K> Map for K {
type Key = K;
}
fn main() {
let _ = &()
as &dyn Map<Key=u32,MapValue=u32>;
//~^ ERROR E0038
}rust-analyzer 1.77.0-nightly (595bc6f 2024-01-05)
rust-analyzer highlight < issue-26056.rs
thread 'main' panicked at /rust/deps/chalk-ir-0.95.0/src/fold.rs:437:13:
unexpected free variable with depth `^1.0` with outer binder ^0
stack backtrace:
0: rust_begin_unwind
at /rustc/595bc6f00369475047538fdae1ff8cea692ac385/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/595bc6f00369475047538fdae1ff8cea692ac385/library/core/src/panicking.rs:72:14
2: <chalk_solve::infer::canonicalize::Canonicalizer<hir_ty::interner::Interner> as chalk_ir::fold::FallibleTypeFolder<hir_ty::interner::Interner>>::try_fold_free_var_ty
3: <chalk_ir::Ty<hir_ty::interner::Interner> as chalk_ir::fold::TypeSuperFoldable<hir_ty::interner::Interner>>::super_fold_with
4: <core::iter::adapters::GenericShunt<chalk_ir::cast::Casted<core::iter::adapters::map::Map<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<chalk_ir::GenericArg<hir_ty::interner::Interner>>>, <chalk_ir::Substitution<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with<core::convert::Infallible>::{closure#0}>, core::result::Result<chalk_ir::GenericArg<hir_ty::interner::Interner>, core::convert::Infallible>>, core::result::Result<core::convert::Infallible, core::convert::Infallible>> as core::iter::traits::iterator::Iterator>::next
5: <chalk_ir::Substitution<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
6: <chalk_ir::WhereClause<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
7: <chalk_ir::DomainGoal<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
8: <chalk_ir::Goal<hir_ty::interner::Interner> as chalk_ir::fold::TypeSuperFoldable<hir_ty::interner::Interner>>::super_fold_with
9: <chalk_solve::infer::InferenceTable<hir_ty::interner::Interner>>::canonicalize::<chalk_ir::InEnvironment<chalk_ir::Goal<hir_ty::interner::Interner>>>
10: <hir_ty::infer::unify::InferenceTable>::canonicalize::<chalk_ir::InEnvironment<chalk_ir::Goal<hir_ty::interner::Interner>>>
11: <hir_ty::infer::unify::InferenceTable>::register_obligation_in_env
12: <hir_ty::infer::unify::InferenceTable>::normalize_projection_ty
13: <hir_ty::infer::unify::InferenceTable>::normalize_associated_types_in::<chalk_ir::Ty<hir_ty::interner::Interner>>::{closure#0}
14: <hir_ty::fold_tys_and_consts::TyFolder<<hir_ty::infer::unify::InferenceTable>::normalize_associated_types_in<chalk_ir::Ty<hir_ty::interner::Interner>>::{closure#0}> as chalk_ir::fold::FallibleTypeFolder<hir_ty::interner::Interner>>::try_fold_ty
15: <core::iter::adapters::GenericShunt<chalk_ir::cast::Casted<core::iter::adapters::map::Map<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<chalk_ir::GenericArg<hir_ty::interner::Interner>>>, <chalk_ir::Substitution<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with<core::convert::Infallible>::{closure#0}>, core::result::Result<chalk_ir::GenericArg<hir_ty::interner::Interner>, core::convert::Infallible>>, core::result::Result<core::convert::Infallible, core::convert::Infallible>> as core::iter::traits::iterator::Iterator>::next
16: <chalk_ir::Substitution<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
17: <chalk_ir::WhereClause<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
18: <chalk_ir::QuantifiedWhereClauses<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
19: <chalk_ir::DynTy<hir_ty::interner::Interner> as chalk_ir::fold::TypeFoldable<hir_ty::interner::Interner>>::try_fold_with::<core::convert::Infallible>
20: <chalk_ir::Ty<hir_ty::interner::Interner> as chalk_ir::fold::TypeSuperFoldable<hir_ty::interner::Interner>>::super_fold_with
21: <hir_ty::fold_tys_and_consts::TyFolder<<hir_ty::infer::unify::InferenceTable>::normalize_associated_types_in<chalk_ir::Ty<hir_ty::interner::Interner>>::{closure#0}> as chalk_ir::fold::FallibleTypeFolder<hir_ty::interner::Interner>>::try_fold_ty
22: <chalk_ir::Ty<hir_ty::interner::Interner> as chalk_ir::fold::TypeSuperFoldable<hir_ty::interner::Interner>>::super_fold_with
23: <hir_ty::infer::InferenceContext>::make_ty
24: <hir_ty::infer::InferenceContext>::infer_expr_inner
25: <hir_ty::infer::InferenceContext>::infer_expr_coerce
26: <hir_ty::infer::InferenceContext>::infer_block
27: <hir_ty::infer::InferenceContext>::infer_expr_inner
28: <hir_ty::infer::InferenceContext>::infer_return
29: hir_ty::infer::infer_query
30: <salsa::derived::slot::Slot<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue>>::execute
31: <_ as hir_ty::db::HirDatabase>::infer_query::__shim
32: hir_ty::db::infer_wait
33: <hir::semantics::SemanticsImpl>::analyze_impl
34: <hir::semantics::SemanticsImpl>::resolve_path
35: <ide_db::defs::NameRefClass>::classify
36: ide::syntax_highlighting::highlight
37: <ide::Analysis>::highlight_as_html
38: <rust_analyzer::cli::flags::Highlight>::run
39: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugI-panic