@@ -36,12 +36,13 @@ use crate::{
36
36
consteval::try_const_usize,
37
37
db::{HirDatabase, InternedClosure},
38
38
from_assoc_type_id, from_foreign_def_id, from_placeholder_idx,
39
+ generics::generics,
39
40
layout::Layout,
40
41
lt_from_placeholder_idx,
41
42
mapping::from_chalk,
42
43
mir::pad16,
43
44
primitive, to_assoc_type_id,
44
- utils::{self, detect_variant_from_bytes, generics, ClosureSubst},
45
+ utils::{self, detect_variant_from_bytes, ClosureSubst},
45
46
AdtId, AliasEq, AliasTy, Binders, CallableDefId, CallableSig, ConcreteConst, Const,
46
47
ConstScalar, ConstValue, DomainGoal, FnAbi, GenericArg, ImplTraitId, Interner, Lifetime,
47
48
LifetimeData, LifetimeOutlives, MemoryMap, Mutability, OpaqueTy, ProjectionTy, ProjectionTyExt,
@@ -493,7 +494,7 @@ impl HirDisplay for Const {
493
494
ConstValue::Placeholder(idx) => {
494
495
let id = from_placeholder_idx(f.db, *idx);
495
496
let generics = generics(f.db.upcast(), id.parent);
496
- let param_data = &generics.params [id.local_id];
497
+ let param_data = &generics[id.local_id];
497
498
write!(f, "{}", param_data.name().unwrap().display(f.db.upcast()))?;
498
499
Ok(())
499
500
}
@@ -988,15 +989,15 @@ impl HirDisplay for Ty {
988
989
989
990
if parameters.len(Interner) > 0 {
990
991
let generics = generics(db.upcast(), def.into());
991
- let (parent_len, self_ , type_, const_, impl_, lifetime) =
992
+ let (parent_len, self_param , type_, const_, impl_, lifetime) =
992
993
generics.provenance_split();
993
994
let parameters = parameters.as_slice(Interner);
994
995
// We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
995
996
if parameters.len() - impl_ > 0 {
996
997
// `parameters` are in the order of fn's params (including impl traits), fn's lifetimes
997
998
// parent's params (those from enclosing impl or trait, if any).
998
999
let (fn_params, other) =
999
- parameters.split_at(self_ + type_ + const_ + lifetime);
1000
+ parameters.split_at(self_param as usize + type_ + const_ + lifetime);
1000
1001
let (_impl, parent_params) = other.split_at(impl_);
1001
1002
debug_assert_eq!(parent_params.len(), parent_len);
1002
1003
@@ -1215,7 +1216,7 @@ impl HirDisplay for Ty {
1215
1216
TyKind::Placeholder(idx) => {
1216
1217
let id = from_placeholder_idx(db, *idx);
1217
1218
let generics = generics(db.upcast(), id.parent);
1218
- let param_data = &generics.params [id.local_id];
1219
+ let param_data = &generics[id.local_id];
1219
1220
match param_data {
1220
1221
TypeOrConstParamData::TypeParamData(p) => match p.provenance {
1221
1222
TypeParamProvenance::TypeParamList | TypeParamProvenance::TraitSelf => {
@@ -1797,7 +1798,7 @@ impl HirDisplay for LifetimeData {
1797
1798
LifetimeData::Placeholder(idx) => {
1798
1799
let id = lt_from_placeholder_idx(f.db, *idx);
1799
1800
let generics = generics(f.db.upcast(), id.parent);
1800
- let param_data = &generics.params [id.local_id];
1801
+ let param_data = &generics[id.local_id];
1801
1802
write!(f, "{}", param_data.name.display(f.db.upcast()))?;
1802
1803
Ok(())
1803
1804
}
0 commit comments