diff options
author | Florian Diebold <[email protected]> | 2021-04-07 19:48:58 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-07 19:48:58 +0100 |
commit | be0084a0bc903544835d5c87df9eb9ce29a191d1 (patch) | |
tree | 104415f4dba0bbb2f47c566e53a218848451184c /crates | |
parent | d1b645d2360fb6e74aaa774ff713af02f685a110 (diff) |
InEnvironment::new takes a reference
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/hir_ty/src/infer.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/coerce.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/types.rs | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 7ac9118fa..0afc06906 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1791,7 +1791,7 @@ impl Type { | |||
1791 | .build(); | 1791 | .build(); |
1792 | 1792 | ||
1793 | let goal = Canonical { | 1793 | let goal = Canonical { |
1794 | value: hir_ty::InEnvironment::new(self.env.env.clone(), trait_ref.cast(&Interner)), | 1794 | value: hir_ty::InEnvironment::new(&self.env.env, trait_ref.cast(&Interner)), |
1795 | binders: CanonicalVarKinds::empty(&Interner), | 1795 | binders: CanonicalVarKinds::empty(&Interner), |
1796 | }; | 1796 | }; |
1797 | 1797 | ||
@@ -1810,7 +1810,7 @@ impl Type { | |||
1810 | .build(); | 1810 | .build(); |
1811 | let goal = hir_ty::make_canonical( | 1811 | let goal = hir_ty::make_canonical( |
1812 | InEnvironment::new( | 1812 | InEnvironment::new( |
1813 | self.env.env.clone(), | 1813 | &self.env.env, |
1814 | AliasEq { | 1814 | AliasEq { |
1815 | alias: AliasTy::Projection(projection), | 1815 | alias: AliasTy::Projection(projection), |
1816 | ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) | 1816 | ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) |
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 6af0c59b8..531159e54 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
@@ -336,7 +336,7 @@ impl<'a> InferenceContext<'a> { | |||
336 | self.last_obligations_check = Some(self.table.revision); | 336 | self.last_obligations_check = Some(self.table.revision); |
337 | let obligations = mem::replace(&mut self.obligations, Vec::new()); | 337 | let obligations = mem::replace(&mut self.obligations, Vec::new()); |
338 | for obligation in obligations { | 338 | for obligation in obligations { |
339 | let in_env = InEnvironment::new(self.trait_env.env.clone(), obligation.clone()); | 339 | let in_env = InEnvironment::new(&self.trait_env.env, obligation.clone()); |
340 | let canonicalized = self.canonicalizer().canonicalize_obligation(in_env); | 340 | let canonicalized = self.canonicalizer().canonicalize_obligation(in_env); |
341 | let solution = | 341 | let solution = |
342 | self.db.trait_solve(self.resolver.krate().unwrap(), canonicalized.value.clone()); | 342 | self.db.trait_solve(self.resolver.krate().unwrap(), canonicalized.value.clone()); |
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index f1af2a0bd..fd679f444 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
@@ -139,7 +139,7 @@ impl<'a> InferenceContext<'a> { | |||
139 | b.push(from_ty.clone()).push(to_ty.clone()).build() | 139 | b.push(from_ty.clone()).push(to_ty.clone()).build() |
140 | }; | 140 | }; |
141 | 141 | ||
142 | let goal = InEnvironment::new(self.trait_env.env.clone(), trait_ref.cast(&Interner)); | 142 | let goal = InEnvironment::new(&self.trait_env.env, trait_ref.cast(&Interner)); |
143 | 143 | ||
144 | let canonicalizer = self.canonicalizer(); | 144 | let canonicalizer = self.canonicalizer(); |
145 | let canonicalized = canonicalizer.canonicalize_obligation(goal); | 145 | let canonicalized = canonicalizer.canonicalize_obligation(goal); |
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 7380b8613..7e09a1539 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -845,7 +845,7 @@ fn generic_implements_goal( | |||
845 | let obligation = trait_ref.cast(&Interner); | 845 | let obligation = trait_ref.cast(&Interner); |
846 | Canonical { | 846 | Canonical { |
847 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), | 847 | binders: CanonicalVarKinds::from_iter(&Interner, kinds), |
848 | value: InEnvironment::new(env.env.clone(), obligation), | 848 | value: InEnvironment::new(&env.env, obligation), |
849 | } | 849 | } |
850 | } | 850 | } |
851 | 851 | ||
diff --git a/crates/hir_ty/src/types.rs b/crates/hir_ty/src/types.rs index 72be7e04f..e1a28f5f7 100644 --- a/crates/hir_ty/src/types.rs +++ b/crates/hir_ty/src/types.rs | |||
@@ -470,8 +470,8 @@ pub struct InEnvironment<T> { | |||
470 | } | 470 | } |
471 | 471 | ||
472 | impl<T> InEnvironment<T> { | 472 | impl<T> InEnvironment<T> { |
473 | pub fn new(environment: chalk_ir::Environment<Interner>, value: T) -> InEnvironment<T> { | 473 | pub fn new(environment: &chalk_ir::Environment<Interner>, value: T) -> InEnvironment<T> { |
474 | InEnvironment { environment, goal: value } | 474 | InEnvironment { environment: environment.clone(), goal: value } |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||