Closed
Description
rust-analyzer version: rust-analyzer 134dbc6 2022-04-07 dev
rustc version: rustc 1.62.0-nightly (60e50fc1c 2022-04-04)
relevant settings: N/A
I originally was using "rust-analyzer 46d7ee6 2022-04-04 stable" but saw the fix for #11769 was merged, so I built the latest master locally but I'm still hitting a similar error.
The traces are slightly different though so I'm not sure if it's exactly the same thing as what's happening in #11769
Reproduction:
#![feature(generic_associated_types)]
fn main() {}
pub trait Inner<T> {}
pub trait Outer {
type Sample<T>: Inner<T>;
fn get_sample<T>(value: T) -> Self::Sample<T>;
}
// Note: Commenting out the impls makes the crash stop
impl<T> Inner<T> for [T; 1] {}
struct Foo;
impl Outer for Foo {
type Sample<T> = [T; 1];
fn get_sample<T>(value: T) -> Self::Sample<T> {
[value]
}
}
analysis-stats
Panic:
Database loaded: 1.37s (metadata 1.09s; build 209.66ms)
crates: 1, mods: 1, decls: 6, fns: 2
Item Collection: 3.61s
1/2 50% processing: get_samplePanic context:
> solving UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([for<> FromEnv(!0_0: Sized)]), goal: AliasEq(<Foo<[]> as Outer>::Sample = ^0.0) }, binders: [U0 with kind type] }, universes: 1 }
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', crates/hir_ty/src/utils.rs:308:18
stack backtrace:
0: rust_begin_unwind
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
2: core::panicking::panic
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:48:5
3: hir_ty::utils::Generics::find_param
4: hir_ty::lower::TyLoweringContext::lower_partly_resolved_path
5: hir_ty::lower::TyLoweringContext::lower_ty_ext
6: hir_ty::lower::TyLoweringContext::substs_from_path_segment
7: hir_ty::lower::TyLoweringContext::lower_trait_ref_from_path
8: hir_ty::lower::TyLoweringContext::lower_type_bound
9: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
10: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
12: hir_ty::chalk_db::associated_ty_data_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: salsa::QueryTable<Q>::get
17: <DB as hir_ty::db::HirDatabase>::associated_ty_data::__shim
18: chalk_solve::split::Split::split_projection
19: chalk_solve::split::Split::trait_ref_from_projection
20: chalk_solve::clauses::program_clauses_that_could_match
21: chalk_recursive::solve::SolveIteration::solve_iteration
22: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
23: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_root_goal
24: scoped_tls::ScopedKey<T>::set
25: <hir_ty::db::TraitSolveQueryQuery as salsa::plumbing::QueryFunction>::execute
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: salsa::QueryTable<Q>::get
30: <DB as hir_ty::db::HirDatabase>::trait_solve_query::__shim
31: <DB as hir_ty::db::HirDatabase>::trait_solve_query
32: hir_ty::db::trait_solve_wait
33: <DB as hir_ty::db::HirDatabase>::trait_solve
34: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
35: hir_ty::infer::unify::InferenceTable::normalize_projection_ty
36: <hir_ty::fold_tys_and_consts::TyFolder<F> as chalk_ir::fold::Folder<hir_ty::interner::Interner>>::fold_ty
37: hir_ty::infer::InferenceContext::make_ty_with_mode
38: hir_ty::infer::infer_query
39: salsa::runtime::Runtime::execute_query_implementation
40: salsa::derived::slot::Slot<Q,MP>::read_upgrade
41: salsa::derived::slot::Slot<Q,MP>::read
42: salsa::QueryTable<Q>::get
43: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
44: hir_ty::db::infer_wait
45: rust_analyzer::cli::analysis_stats::<impl rust_analyzer::cli::flags::AnalysisStats>::run_inference
46: rust_analyzer::cli::analysis_stats::<impl rust_analyzer::cli::flags::AnalysisStats>::run
47: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.