]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/traits/chalk.rs
Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup
[rust.git] / compiler / rustc_middle / src / traits / chalk.rs
index 74873778f74ba16dc213d9edbd9a6a98a80c3ac3..09a28249cce5ba18758bd34d9e609db4424c3201 100644 (file)
@@ -206,35 +206,36 @@ fn debug_opaque_ty(
         Some(write!(fmt, "{:?}", opaque_ty.opaque_ty_id))
     }
 
-    fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Self::InternedType {
-        Box::new(ty)
+    fn intern_ty(self, ty: chalk_ir::TyKind<Self>) -> Self::InternedType {
+        let flags = ty.compute_flags(self);
+        Box::new(chalk_ir::TyData { kind: ty, flags: flags })
     }
 
-    fn ty_data<'a>(&self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> {
+    fn ty_data<'a>(self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> {
         ty
     }
 
-    fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime {
+    fn intern_lifetime(self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime {
         Box::new(lifetime)
     }
 
     fn lifetime_data<'a>(
-        &self,
+        self,
         lifetime: &'a Self::InternedLifetime,
     ) -> &'a chalk_ir::LifetimeData<Self> {
         &lifetime
     }
 
-    fn intern_const(&self, constant: chalk_ir::ConstData<Self>) -> Self::InternedConst {
+    fn intern_const(self, constant: chalk_ir::ConstData<Self>) -> Self::InternedConst {
         Box::new(constant)
     }
 
-    fn const_data<'a>(&self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData<Self> {
+    fn const_data<'a>(self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData<Self> {
         &constant
     }
 
     fn const_eq(
-        &self,
+        self,
         _ty: &Self::InternedType,
         c1: &Self::InternedConcreteConst,
         c2: &Self::InternedConcreteConst,
@@ -242,143 +243,143 @@ fn const_eq(
         c1 == c2
     }
 
-    fn intern_generic_arg(&self, data: chalk_ir::GenericArgData<Self>) -> Self::InternedGenericArg {
+    fn intern_generic_arg(self, data: chalk_ir::GenericArgData<Self>) -> Self::InternedGenericArg {
         Box::new(data)
     }
 
     fn generic_arg_data<'a>(
-        &self,
+        self,
         data: &'a Self::InternedGenericArg,
     ) -> &'a chalk_ir::GenericArgData<Self> {
         &data
     }
 
-    fn intern_goal(&self, goal: chalk_ir::GoalData<Self>) -> Self::InternedGoal {
+    fn intern_goal(self, goal: chalk_ir::GoalData<Self>) -> Self::InternedGoal {
         Box::new(goal)
     }
 
-    fn goal_data<'a>(&self, goal: &'a Self::InternedGoal) -> &'a chalk_ir::GoalData<Self> {
+    fn goal_data<'a>(self, goal: &'a Self::InternedGoal) -> &'a chalk_ir::GoalData<Self> {
         &goal
     }
 
     fn intern_goals<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::Goal<Self>, E>>,
     ) -> Result<Self::InternedGoals, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
-    fn goals_data<'a>(&self, goals: &'a Self::InternedGoals) -> &'a [chalk_ir::Goal<Self>] {
+    fn goals_data<'a>(self, goals: &'a Self::InternedGoals) -> &'a [chalk_ir::Goal<Self>] {
         goals
     }
 
     fn intern_substitution<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::GenericArg<Self>, E>>,
     ) -> Result<Self::InternedSubstitution, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn substitution_data<'a>(
-        &self,
+        self,
         substitution: &'a Self::InternedSubstitution,
     ) -> &'a [chalk_ir::GenericArg<Self>] {
         substitution
     }
 
     fn intern_program_clause(
-        &self,
+        self,
         data: chalk_ir::ProgramClauseData<Self>,
     ) -> Self::InternedProgramClause {
         Box::new(data)
     }
 
     fn program_clause_data<'a>(
-        &self,
+        self,
         clause: &'a Self::InternedProgramClause,
     ) -> &'a chalk_ir::ProgramClauseData<Self> {
         &clause
     }
 
     fn intern_program_clauses<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>,
     ) -> Result<Self::InternedProgramClauses, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn program_clauses_data<'a>(
-        &self,
+        self,
         clauses: &'a Self::InternedProgramClauses,
     ) -> &'a [chalk_ir::ProgramClause<Self>] {
         clauses
     }
 
     fn intern_quantified_where_clauses<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>,
     ) -> Result<Self::InternedQuantifiedWhereClauses, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn quantified_where_clauses_data<'a>(
-        &self,
+        self,
         clauses: &'a Self::InternedQuantifiedWhereClauses,
     ) -> &'a [chalk_ir::QuantifiedWhereClause<Self>] {
         clauses
     }
 
     fn intern_generic_arg_kinds<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::VariableKind<Self>, E>>,
     ) -> Result<Self::InternedVariableKinds, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn variable_kinds_data<'a>(
-        &self,
+        self,
         parameter_kinds: &'a Self::InternedVariableKinds,
     ) -> &'a [chalk_ir::VariableKind<Self>] {
         parameter_kinds
     }
 
     fn intern_canonical_var_kinds<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::CanonicalVarKind<Self>, E>>,
     ) -> Result<Self::InternedCanonicalVarKinds, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn canonical_var_kinds_data<'a>(
-        &self,
+        self,
         canonical_var_kinds: &'a Self::InternedCanonicalVarKinds,
     ) -> &'a [chalk_ir::CanonicalVarKind<Self>] {
         canonical_var_kinds
     }
 
     fn intern_constraints<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>, E>>,
     ) -> Result<Self::InternedConstraints, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn constraints_data<'a>(
-        &self,
+        self,
         constraints: &'a Self::InternedConstraints,
     ) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
         constraints
     }
 
     fn intern_variances<E>(
-        &self,
+        self,
         data: impl IntoIterator<Item = Result<chalk_ir::Variance, E>>,
     ) -> Result<Self::InternedVariances, E> {
         data.into_iter().collect::<Result<Vec<_>, _>>()
     }
 
     fn variances_data<'a>(
-        &self,
+        self,
         variances: &'a Self::InternedVariances,
     ) -> &'a [chalk_ir::Variance] {
         variances