aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-07 19:48:58 +0100
committerFlorian Diebold <[email protected]>2021-04-07 19:48:58 +0100
commitbe0084a0bc903544835d5c87df9eb9ce29a191d1 (patch)
tree104415f4dba0bbb2f47c566e53a218848451184c /crates/hir_ty/src
parentd1b645d2360fb6e74aaa774ff713af02f685a110 (diff)
InEnvironment::new takes a reference
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/infer.rs2
-rw-r--r--crates/hir_ty/src/infer/coerce.rs2
-rw-r--r--crates/hir_ty/src/method_resolution.rs2
-rw-r--r--crates/hir_ty/src/types.rs4
4 files changed, 5 insertions, 5 deletions
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
472impl<T> InEnvironment<T> { 472impl<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