mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
More renaming
This commit is contained in:
parent
eea777c714
commit
1954147834
5 changed files with 23 additions and 19 deletions
|
@ -1979,7 +1979,7 @@ impl Type {
|
||||||
walk_bounds(db, &type_.derived(ty.clone()), &bounds, cb);
|
walk_bounds(db, &type_.derived(ty.clone()), &bounds, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
walk_substs(db, type_, &opaque_ty.parameters, cb);
|
walk_substs(db, type_, &opaque_ty.substitution, cb);
|
||||||
}
|
}
|
||||||
TyKind::Placeholder(_) => {
|
TyKind::Placeholder(_) => {
|
||||||
if let Some(bounds) = ty.impl_trait_bounds(db) {
|
if let Some(bounds) = ty.impl_trait_bounds(db) {
|
||||||
|
|
|
@ -319,7 +319,10 @@ impl HirDisplay for Ty {
|
||||||
TyKind::Dyn(predicates) if predicates.len() > 1 => {
|
TyKind::Dyn(predicates) if predicates.len() > 1 => {
|
||||||
Cow::Borrowed(predicates.as_ref())
|
Cow::Borrowed(predicates.as_ref())
|
||||||
}
|
}
|
||||||
&TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, ref parameters })) => {
|
&TyKind::Alias(AliasTy::Opaque(OpaqueTy {
|
||||||
|
opaque_ty_id,
|
||||||
|
substitution: ref parameters,
|
||||||
|
})) => {
|
||||||
let impl_trait_id = f.db.lookup_intern_impl_trait_id(opaque_ty_id.into());
|
let impl_trait_id = f.db.lookup_intern_impl_trait_id(opaque_ty_id.into());
|
||||||
if let ImplTraitId::ReturnTypeImplTrait(func, idx) = impl_trait_id {
|
if let ImplTraitId::ReturnTypeImplTrait(func, idx) = impl_trait_id {
|
||||||
datas =
|
datas =
|
||||||
|
@ -579,7 +582,7 @@ impl HirDisplay for Ty {
|
||||||
let data = (*datas)
|
let data = (*datas)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
||||||
let bounds = data.subst(&opaque_ty.parameters);
|
let bounds = data.subst(&opaque_ty.substitution);
|
||||||
write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?;
|
write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?;
|
||||||
}
|
}
|
||||||
ImplTraitId::AsyncBlockTypeImplTrait(..) => {
|
ImplTraitId::AsyncBlockTypeImplTrait(..) => {
|
||||||
|
|
|
@ -66,7 +66,7 @@ pub enum Lifetime {
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
pub struct OpaqueTy {
|
pub struct OpaqueTy {
|
||||||
pub opaque_ty_id: OpaqueTyId,
|
pub opaque_ty_id: OpaqueTyId,
|
||||||
pub parameters: Substs,
|
pub substitution: Substs,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A "projection" type corresponds to an (unnormalized)
|
/// A "projection" type corresponds to an (unnormalized)
|
||||||
|
@ -903,7 +903,7 @@ impl Ty {
|
||||||
let data = (*it)
|
let data = (*it)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
.map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
|
||||||
data.subst(&opaque_ty.parameters)
|
data.subst(&opaque_ty.substitution)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// It always has an parameter for Future::Output type.
|
// It always has an parameter for Future::Output type.
|
||||||
|
@ -1059,7 +1059,7 @@ impl TypeWalk for Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TyKind::Alias(AliasTy::Opaque(o_ty)) => {
|
TyKind::Alias(AliasTy::Opaque(o_ty)) => {
|
||||||
for t in o_ty.parameters.iter() {
|
for t in o_ty.substitution.iter() {
|
||||||
t.walk(f);
|
t.walk(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1094,7 @@ impl TypeWalk for Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TyKind::Alias(AliasTy::Opaque(o_ty)) => {
|
TyKind::Alias(AliasTy::Opaque(o_ty)) => {
|
||||||
o_ty.parameters.walk_mut_binders(f, binders);
|
o_ty.substitution.walk_mut_binders(f, binders);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if let Some(substs) = self.substs_mut() {
|
if let Some(substs) = self.substs_mut() {
|
||||||
|
|
|
@ -230,7 +230,10 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into();
|
let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into();
|
||||||
let generics = generics(self.db.upcast(), func.into());
|
let generics = generics(self.db.upcast(), func.into());
|
||||||
let parameters = Substs::bound_vars(&generics, self.in_binders);
|
let parameters = Substs::bound_vars(&generics, self.in_binders);
|
||||||
TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, parameters }))
|
TyKind::Alias(AliasTy::Opaque(OpaqueTy {
|
||||||
|
opaque_ty_id,
|
||||||
|
substitution: parameters,
|
||||||
|
}))
|
||||||
.intern(&Interner)
|
.intern(&Interner)
|
||||||
}
|
}
|
||||||
ImplTraitLoweringMode::Param => {
|
ImplTraitLoweringMode::Param => {
|
||||||
|
|
|
@ -87,6 +87,13 @@ impl ToChalk for Ty {
|
||||||
.cast(&Interner)
|
.cast(&Interner)
|
||||||
.intern(&Interner)
|
.intern(&Interner)
|
||||||
}
|
}
|
||||||
|
TyKind::Alias(AliasTy::Opaque(opaque_ty)) => {
|
||||||
|
let opaque_ty_id = opaque_ty.opaque_ty_id;
|
||||||
|
let substitution = opaque_ty.substitution.to_chalk(db);
|
||||||
|
chalk_ir::AliasTy::Opaque(chalk_ir::OpaqueTy { opaque_ty_id, substitution })
|
||||||
|
.cast(&Interner)
|
||||||
|
.intern(&Interner)
|
||||||
|
}
|
||||||
TyKind::Placeholder(idx) => idx.to_ty::<Interner>(&Interner),
|
TyKind::Placeholder(idx) => idx.to_ty::<Interner>(&Interner),
|
||||||
TyKind::BoundVar(idx) => chalk_ir::TyKind::BoundVar(idx).intern(&Interner),
|
TyKind::BoundVar(idx) => chalk_ir::TyKind::BoundVar(idx).intern(&Interner),
|
||||||
TyKind::InferenceVar(..) => panic!("uncanonicalized infer ty"),
|
TyKind::InferenceVar(..) => panic!("uncanonicalized infer ty"),
|
||||||
|
@ -101,15 +108,6 @@ impl ToChalk for Ty {
|
||||||
};
|
};
|
||||||
chalk_ir::TyKind::Dyn(bounded_ty).intern(&Interner)
|
chalk_ir::TyKind::Dyn(bounded_ty).intern(&Interner)
|
||||||
}
|
}
|
||||||
TyKind::Alias(AliasTy::Opaque(opaque_ty)) => {
|
|
||||||
let opaque_ty_id = opaque_ty.opaque_ty_id;
|
|
||||||
let substitution = opaque_ty.parameters.to_chalk(db);
|
|
||||||
chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(chalk_ir::OpaqueTy {
|
|
||||||
opaque_ty_id,
|
|
||||||
substitution,
|
|
||||||
}))
|
|
||||||
.intern(&Interner)
|
|
||||||
}
|
|
||||||
TyKind::Unknown => chalk_ir::TyKind::Error.intern(&Interner),
|
TyKind::Unknown => chalk_ir::TyKind::Error.intern(&Interner),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +127,7 @@ impl ToChalk for Ty {
|
||||||
chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(opaque_ty)) => {
|
chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(opaque_ty)) => {
|
||||||
let opaque_ty_id = opaque_ty.opaque_ty_id;
|
let opaque_ty_id = opaque_ty.opaque_ty_id;
|
||||||
let parameters = from_chalk(db, opaque_ty.substitution);
|
let parameters = from_chalk(db, opaque_ty.substitution);
|
||||||
TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, parameters }))
|
TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, substitution: parameters }))
|
||||||
}
|
}
|
||||||
chalk_ir::TyKind::Function(chalk_ir::FnPointer {
|
chalk_ir::TyKind::Function(chalk_ir::FnPointer {
|
||||||
num_binders,
|
num_binders,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue