mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Binders::wrap_empty -> wrap_empty_binders
This commit is contained in:
parent
2f5a77658b
commit
738174671a
3 changed files with 12 additions and 16 deletions
|
@ -92,13 +92,11 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> {
|
||||||
generics(db.upcast(), id.parent).param_idx(id)
|
generics(db.upcast(), id.parent).param_idx(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Binders<T> {
|
pub fn wrap_empty_binders<T>(value: T) -> Binders<T>
|
||||||
pub fn wrap_empty(value: T) -> Self
|
where
|
||||||
where
|
T: TypeWalk,
|
||||||
T: TypeWalk,
|
{
|
||||||
{
|
Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE))
|
||||||
Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: TypeWalk> Binders<T> {
|
impl<T: TypeWalk> Binders<T> {
|
||||||
|
|
|
@ -384,7 +384,9 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
1,
|
1,
|
||||||
QuantifiedWhereClauses::from_iter(
|
QuantifiedWhereClauses::from_iter(
|
||||||
&Interner,
|
&Interner,
|
||||||
Some(Binders::wrap_empty(WhereClause::Implemented(trait_ref))),
|
Some(crate::wrap_empty_binders(WhereClause::Implemented(
|
||||||
|
trait_ref,
|
||||||
|
))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
@ -720,7 +722,7 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
let trait_ref = match bound {
|
let trait_ref = match bound {
|
||||||
TypeBound::Path(path) => {
|
TypeBound::Path(path) => {
|
||||||
bindings = self.lower_trait_ref_from_path(path, Some(self_ty));
|
bindings = self.lower_trait_ref_from_path(path, Some(self_ty));
|
||||||
bindings.clone().map(WhereClause::Implemented).map(|b| Binders::wrap_empty(b))
|
bindings.clone().map(WhereClause::Implemented).map(|b| crate::wrap_empty_binders(b))
|
||||||
}
|
}
|
||||||
TypeBound::Lifetime(_) => None,
|
TypeBound::Lifetime(_) => None,
|
||||||
TypeBound::Error => None,
|
TypeBound::Error => None,
|
||||||
|
@ -767,7 +769,7 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
let ty = self.lower_ty(type_ref);
|
let ty = self.lower_ty(type_ref);
|
||||||
let alias_eq =
|
let alias_eq =
|
||||||
AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty };
|
AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty };
|
||||||
preds.push(Binders::wrap_empty(WhereClause::AliasEq(alias_eq)));
|
preds.push(crate::wrap_empty_binders(WhereClause::AliasEq(alias_eq)));
|
||||||
}
|
}
|
||||||
for bound in &binding.bounds {
|
for bound in &binding.bounds {
|
||||||
preds.extend(self.lower_type_bound(
|
preds.extend(self.lower_type_bound(
|
||||||
|
|
|
@ -246,8 +246,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
|
||||||
let bound = OpaqueTyDatumBound {
|
let bound = OpaqueTyDatumBound {
|
||||||
bounds: make_binders(
|
bounds: make_binders(
|
||||||
vec![
|
vec![
|
||||||
wrap_in_empty_binders(impl_bound).to_chalk(self.db),
|
crate::wrap_empty_binders(impl_bound).to_chalk(self.db),
|
||||||
wrap_in_empty_binders(proj_bound).to_chalk(self.db),
|
crate::wrap_empty_binders(proj_bound).to_chalk(self.db),
|
||||||
],
|
],
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
|
@ -723,7 +723,3 @@ impl From<crate::db::InternedClosureId> for chalk_ir::ClosureId<Interner> {
|
||||||
chalk_ir::ClosureId(id.as_intern_id())
|
chalk_ir::ClosureId(id.as_intern_id())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_in_empty_binders<T: crate::TypeWalk>(value: T) -> crate::Binders<T> {
|
|
||||||
crate::Binders::wrap_empty(value)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue