Skip to content

Commit be0084a

Browse files
committed
InEnvironment::new takes a reference
1 parent d1b645d commit be0084a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

crates/hir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ impl Type {
17911791
.build();
17921792

17931793
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)),
17951795
binders: CanonicalVarKinds::empty(&Interner),
17961796
};
17971797

@@ -1810,7 +1810,7 @@ impl Type {
18101810
.build();
18111811
let goal = hir_ty::make_canonical(
18121812
InEnvironment::new(
1813-
self.env.env.clone(),
1813+
&self.env.env,
18141814
AliasEq {
18151815
alias: AliasTy::Projection(projection),
18161816
ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0))

crates/hir_ty/src/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'a> InferenceContext<'a> {
336336
self.last_obligations_check = Some(self.table.revision);
337337
let obligations = mem::replace(&mut self.obligations, Vec::new());
338338
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());
340340
let canonicalized = self.canonicalizer().canonicalize_obligation(in_env);
341341
let solution =
342342
self.db.trait_solve(self.resolver.krate().unwrap(), canonicalized.value.clone());

crates/hir_ty/src/infer/coerce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a> InferenceContext<'a> {
139139
b.push(from_ty.clone()).push(to_ty.clone()).build()
140140
};
141141

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));
143143

144144
let canonicalizer = self.canonicalizer();
145145
let canonicalized = canonicalizer.canonicalize_obligation(goal);

crates/hir_ty/src/method_resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ fn generic_implements_goal(
845845
let obligation = trait_ref.cast(&Interner);
846846
Canonical {
847847
binders: CanonicalVarKinds::from_iter(&Interner, kinds),
848-
value: InEnvironment::new(env.env.clone(), obligation),
848+
value: InEnvironment::new(&env.env, obligation),
849849
}
850850
}
851851

crates/hir_ty/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ pub struct InEnvironment<T> {
470470
}
471471

472472
impl<T> InEnvironment<T> {
473-
pub fn new(environment: chalk_ir::Environment<Interner>, value: T) -> InEnvironment<T> {
474-
InEnvironment { environment, goal: value }
473+
pub fn new(environment: &chalk_ir::Environment<Interner>, value: T) -> InEnvironment<T> {
474+
InEnvironment { environment: environment.clone(), goal: value }
475475
}
476476
}
477477

0 commit comments

Comments
 (0)