Skip to content

Commit 7a60ab7

Browse files
committed
Don't add Copy/Clone clauses for mutable refs
1 parent 37a38f9 commit 7a60ab7

File tree

1 file changed

+4
-2
lines changed
  • chalk-solve/src/clauses/builtin_traits

1 file changed

+4
-2
lines changed

chalk-solve/src/clauses/builtin_traits/copy.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::clauses::builtin_traits::needs_impl_for_tys;
22
use crate::clauses::ClauseBuilder;
33
use crate::{Interner, RustIrDatabase, TraitRef};
4-
use chalk_ir::{ApplicationTy, Substitution, TyData, TypeName};
4+
use chalk_ir::{ApplicationTy, Mutability, Substitution, TyData, TypeName};
55

66
fn push_tuple_copy_conditions<I: Interner>(
77
db: &dyn RustIrDatabase<I>,
@@ -41,7 +41,9 @@ pub fn add_copy_program_clauses<I: Interner>(
4141
TypeName::Tuple(arity) => {
4242
push_tuple_copy_conditions(db, builder, trait_ref, *arity, substitution)
4343
}
44-
TypeName::Raw(_) | TypeName::Ref(_) => builder.push_fact(trait_ref.clone()),
44+
TypeName::Raw(_) | TypeName::Ref(Mutability::Not) => {
45+
builder.push_fact(trait_ref.clone())
46+
}
4547
_ => return,
4648
},
4749
TyData::Function(_) => builder.push_fact(trait_ref.clone()),

0 commit comments

Comments
 (0)