None
}
+ fn debug_ty(_ty: &chalk_ir::Ty<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_lifetime(
+ _lifetime: &chalk_ir::Lifetime<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_parameter(
+ _parameter: &Parameter<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_goal(_goal: &Goal<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_goals(
+ _goals: &chalk_ir::Goals<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_program_clause_implication(
+ _pci: &chalk_ir::ProgramClauseImplication<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_application_ty(
+ _application_ty: &chalk_ir::ApplicationTy<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_substitution(
+ _substitution: &chalk_ir::Substitution<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
+ fn debug_separator_trait_ref(
+ _separator_trait_ref: &chalk_ir::SeparatorTraitRef<Self>,
+ _fmt: &mut fmt::Formatter<'_>,
+ ) -> Option<fmt::Result> {
+ None
+ }
+
fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> {
Box::new(ty)
}
- fn ty_data(ty: &Box<chalk_ir::TyData<Self>>) -> &chalk_ir::TyData<Self> {
+ fn ty_data<'a>(&self, ty: &'a Box<chalk_ir::TyData<Self>>) -> &'a chalk_ir::TyData<Self> {
ty
}
- fn intern_lifetime(lifetime: chalk_ir::LifetimeData<Self>) -> chalk_ir::LifetimeData<Self> {
+ fn intern_lifetime(
+ &self,
+ lifetime: chalk_ir::LifetimeData<Self>,
+ ) -> chalk_ir::LifetimeData<Self> {
lifetime
}
- fn lifetime_data(lifetime: &chalk_ir::LifetimeData<Self>) -> &chalk_ir::LifetimeData<Self> {
+ fn lifetime_data<'a>(
+ &self,
+ lifetime: &'a chalk_ir::LifetimeData<Self>,
+ ) -> &'a chalk_ir::LifetimeData<Self> {
lifetime
}
- fn intern_parameter(parameter: chalk_ir::ParameterData<Self>) -> chalk_ir::ParameterData<Self> {
+ fn intern_parameter(
+ &self,
+ parameter: chalk_ir::ParameterData<Self>,
+ ) -> chalk_ir::ParameterData<Self> {
parameter
}
- fn parameter_data(parameter: &chalk_ir::ParameterData<Self>) -> &chalk_ir::ParameterData<Self> {
+ fn parameter_data<'a>(
+ &self,
+ parameter: &'a chalk_ir::ParameterData<Self>,
+ ) -> &'a chalk_ir::ParameterData<Self> {
parameter
}
- fn intern_goal(goal: GoalData<Self>) -> Arc<GoalData<Self>> {
+ fn intern_goal(&self, goal: GoalData<Self>) -> Arc<GoalData<Self>> {
Arc::new(goal)
}
- fn intern_goals(data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals {
+ fn intern_goals(&self, data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals {
data.into_iter().collect()
}
- fn goal_data(goal: &Arc<GoalData<Self>>) -> &GoalData<Self> {
+ fn goal_data<'a>(&self, goal: &'a Arc<GoalData<Self>>) -> &'a GoalData<Self> {
goal
}
- fn goals_data(goals: &Vec<Goal<Interner>>) -> &[Goal<Interner>] {
+ fn goals_data<'a>(&self, goals: &'a Vec<Goal<Interner>>) -> &'a [Goal<Interner>] {
goals
}
fn intern_substitution<E>(
+ &self,
data: impl IntoIterator<Item = Result<Parameter<Self>, E>>,
) -> Result<Vec<Parameter<Self>>, E> {
data.into_iter().collect()
}
- fn substitution_data(substitution: &Vec<Parameter<Self>>) -> &[Parameter<Self>] {
+ fn substitution_data<'a>(
+ &self,
+ substitution: &'a Vec<Parameter<Self>>,
+ ) -> &'a [Parameter<Self>] {
substitution
}
}
Ty::Apply(apply_ty) => {
let name = apply_ty.ctor.to_chalk(db);
let substitution = apply_ty.parameters.to_chalk(db);
- chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner)
+ chalk_ir::ApplicationTy { name, substitution }.cast(&Interner).intern(&Interner)
}
Ty::Projection(proj_ty) => {
let associated_ty_id = proj_ty.associated_ty.to_chalk(db);
let substitution = proj_ty.parameters.to_chalk(db);
- chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern(&Interner)
+ chalk_ir::AliasTy { associated_ty_id, substitution }
+ .cast(&Interner)
+ .intern(&Interner)
}
Ty::Placeholder(id) => {
let interned_id = db.intern_type_param_id(id);
chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner)
}
Ty::Opaque(_) | Ty::Unknown => {
- let substitution = chalk_ir::Substitution::empty();
+ let substitution = chalk_ir::Substitution::empty(&Interner);
let name = TypeName::Error;
- chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner)
+ chalk_ir::ApplicationTy { name, substitution }.cast(&Interner).intern(&Interner)
}
}
}
fn from_chalk(db: &dyn HirDatabase, chalk: chalk_ir::Ty<Interner>) -> Self {
- match chalk.data().clone() {
+ match chalk.data(&Interner).clone() {
chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name {
TypeName::Error => Ty::Unknown,
_ => {
type Chalk = chalk_ir::Substitution<Interner>;
fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution<Interner> {
- chalk_ir::Substitution::from(self.iter().map(|ty| ty.clone().to_chalk(db)))
+ chalk_ir::Substitution::from(&Interner, self.iter().map(|ty| ty.clone().to_chalk(db)))
}
fn from_chalk(db: &dyn HirDatabase, parameters: chalk_ir::Substitution<Interner>) -> Substs {
let tys = parameters
- .into_iter()
- .map(|p| match p.ty() {
+ .iter(&Interner)
+ .map(|p| match p.ty(&Interner) {
Some(ty) => from_chalk(db, ty.clone()),
None => unimplemented!(),
})
fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::DomainGoal<Interner> {
match self {
- Obligation::Trait(tr) => tr.to_chalk(db).cast(),
- Obligation::Projection(pr) => pr.to_chalk(db).cast(),
+ Obligation::Trait(tr) => tr.to_chalk(db).cast(&Interner),
+ Obligation::Projection(pr) => pr.to_chalk(db).cast(&Interner),
}
}
continue;
}
let program_clause: chalk_ir::ProgramClause<Interner> =
- pred.clone().to_chalk(db).cast();
- clauses.push(program_clause.into_from_env_clause());
+ pred.clone().to_chalk(db).cast(&Interner);
+ clauses.push(program_clause.into_from_env_clause(&Interner));
}
chalk_ir::Environment::new().add_clauses(clauses)
}
.map(|impl_| impl_.to_chalk(self.db))
.collect();
- let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref().clone());
+ let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone());
let arg: Option<Ty> =
- parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref().clone()));
+ parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone()));
builtin::get_builtin_impls(self.db, self.krate, &ty, &arg, trait_, |i| {
result.push(i.to_chalk(self.db))