Skip to content

Commit bdef1a9

Browse files
committed
Don't emit copy clauses for tys with impls in core
1 parent 5f2ae21 commit bdef1a9

File tree

3 files changed

+2
-69
lines changed

3 files changed

+2
-69
lines changed

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

Lines changed: 1 addition & 4 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, Mutability, Substitution, TyData, TypeName};
4+
use chalk_ir::{ApplicationTy, Substitution, TyData, TypeName};
55

66
fn push_tuple_copy_conditions<I: Interner>(
77
db: &dyn RustIrDatabase<I>,
@@ -41,9 +41,6 @@ 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(Mutability::Not) => {
45-
builder.push_fact(trait_ref.clone())
46-
}
4744
_ => return,
4845
},
4946
TyData::Function(_) => builder.push_fact(trait_ref.clone()),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn add_sized_program_clauses<I: Interner>(
7474
TypeName::Tuple(arity) => {
7575
push_tuple_sized_conditions(db, builder, trait_ref, *arity, substitution)
7676
}
77-
TypeName::Scalar(_) | TypeName::Raw(_) | TypeName::Ref(_) => {
77+
TypeName::Never | TypeName::Scalar(_) | TypeName::Raw(_) | TypeName::Ref(_) => {
7878
builder.push_fact(trait_ref.clone())
7979
}
8080
_ => return,

tests/test/refs.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -57,67 +57,3 @@ fn mut_refs_are_sized() {
5757
}
5858
}
5959
}
60-
61-
#[test]
62-
fn immut_refs_are_copy() {
63-
test! {
64-
program {
65-
#[lang(copy)]
66-
trait Copy { }
67-
}
68-
69-
goal {
70-
forall<'a, T> { &'a T: Copy }
71-
} yields {
72-
"Unique; substitution [], lifetime constraints []"
73-
}
74-
}
75-
}
76-
77-
#[test]
78-
fn immut_refs_are_clone() {
79-
test! {
80-
program {
81-
#[lang(clone)]
82-
trait Clone { }
83-
}
84-
85-
goal {
86-
forall<'a, T> { &'a T: Clone }
87-
} yields {
88-
"Unique; substitution [], lifetime constraints []"
89-
}
90-
}
91-
}
92-
93-
#[test]
94-
fn mut_refs_are_not_copy() {
95-
test! {
96-
program {
97-
#[lang(copy)]
98-
trait Copy { }
99-
}
100-
101-
goal {
102-
forall<'a, T> { not { &'a mut T: Copy } }
103-
} yields {
104-
"Unique; substitution [], lifetime constraints []"
105-
}
106-
}
107-
}
108-
109-
#[test]
110-
fn mut_refs_are_not_clone() {
111-
test! {
112-
program {
113-
#[lang(clone)]
114-
trait Clone { }
115-
}
116-
117-
goal {
118-
forall<'a, T> { not { &'a mut T: Clone } }
119-
} yields {
120-
"Unique; substitution [], lifetime constraints []"
121-
}
122-
}
123-
}

0 commit comments

Comments
 (0)