Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed Aug 4, 2020
1 parent e8a3401 commit db53993
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 103 deletions.
12 changes: 5 additions & 7 deletions chalk-solve/src/clauses/builtin_traits/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ pub fn add_copy_program_clauses<I: Interner>(
needs_impl_for_tys(db, builder, trait_ref, Some(upvars).into_iter());
}

TypeName::Ref(Mutability::Not)
// these impls are in libcore
TypeName::Ref(_)
| TypeName::Raw(_)
| TypeName::Scalar(_)
| TypeName::Never => builder.push_fact(trait_ref.clone()),
| TypeName::Never
| TypeName::Str => {}

TypeName::Ref(Mutability::Mut)
| TypeName::Adt(_)
TypeName::Adt(_)
| TypeName::AssociatedType(_)
| TypeName::Slice
| TypeName::OpaqueType(_)
| TypeName::Str
| TypeName::Error => {}
},

Expand All @@ -96,8 +96,6 @@ pub fn add_copy_program_clauses<I: Interner>(
}
}

// TODO(areredify)
// when #368 lands, extend this to handle everything accordingly
TyData::Alias(_) | TyData::Dyn(_) | TyData::Placeholder(_) => {}
};
}
2 changes: 0 additions & 2 deletions chalk-solve/src/clauses/builtin_traits/sized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ pub fn add_sized_program_clauses<I: Interner>(
ty: &TyData<I>,
binders: &CanonicalVarKinds<I>,
) {
// TODO(areredify)
// when #368 lands, extend this to handle everything accordingly
match ty {
TyData::Apply(ApplicationTy { name, substitution }) => match name {
TypeName::Adt(adt_id) => {
Expand Down
2 changes: 0 additions & 2 deletions tests/test/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ fn functions_are_copy() {
}
}

use crate::test::*;

#[test]
fn function_implement_fn_traits() {
test! {
Expand Down
48 changes: 0 additions & 48 deletions tests/test/refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@ fn immut_refs_are_sized() {
}
}

#[test]
fn immut_refs_are_copy_clone() {
test! {
program {
#[lang(copy)]
trait Copy { }

#[lang(clone)]
trait Clone { }
}

goal {
forall<'a, T> { &'a T: Copy }
} yields {
"Unique; substitution [], lifetime constraints []"
}
goal {
forall<'a, T> { &'a T: Clone }
} yields {
"Unique; substitution [], lifetime constraints []"
}
}
}

#[test]
fn mut_refs_are_well_formed() {
test! {
Expand Down Expand Up @@ -81,27 +57,3 @@ fn mut_refs_are_sized() {
}
}
}

#[test]
fn mut_refs_are_not_copy_clone() {
test! {
program {
#[lang(copy)]
trait Copy { }

#[lang(clone)]
trait Clone { }
}

goal {
forall<'a, T> { &'a mut T: Copy }
} yields {
"No possible solution"
}
goal {
forall<'a, T> { &'a mut T: Clone }
} yields {
"No possible solution"
}
}
}
44 changes: 0 additions & 44 deletions tests/test/scalars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,47 +162,3 @@ fn scalars_are_sized() {
goal { char: Sized } yields { "Unique" }
}
}

#[test]
fn scalars_are_copy_clone() {
test! {
program {
#[lang(copy)] trait Copy { }
#[lang(clone)] trait Clone { }
}

goal { i8: Copy } yields { "Unique" }
goal { i16: Copy } yields { "Unique" }
goal { i32: Copy } yields { "Unique" }
goal { i64: Copy } yields { "Unique" }
goal { i128: Copy } yields { "Unique" }
goal { isize: Copy } yields { "Unique" }
goal { u8: Copy } yields { "Unique" }
goal { u16: Copy } yields { "Unique" }
goal { u32: Copy } yields { "Unique" }
goal { u64: Copy } yields { "Unique" }
goal { u128: Copy } yields { "Unique" }
goal { usize: Copy } yields { "Unique" }
goal { f32: Copy } yields { "Unique" }
goal { f64: Copy } yields { "Unique" }
goal { bool: Copy } yields { "Unique" }
goal { char: Copy } yields { "Unique" }

goal { i8: Clone } yields { "Unique" }
goal { i16: Clone } yields { "Unique" }
goal { i32: Clone } yields { "Unique" }
goal { i64: Clone } yields { "Unique" }
goal { i128: Clone } yields { "Unique" }
goal { isize: Clone } yields { "Unique" }
goal { u8: Clone } yields { "Unique" }
goal { u16: Clone } yields { "Unique" }
goal { u32: Clone } yields { "Unique" }
goal { u64: Clone } yields { "Unique" }
goal { u128: Clone } yields { "Unique" }
goal { usize: Clone } yields { "Unique" }
goal { f32: Clone } yields { "Unique" }
goal { f64: Clone } yields { "Unique" }
goal { bool: Clone } yields { "Unique" }
goal { char: Clone } yields { "Unique" }
}
}

0 comments on commit db53993

Please sign in to comment.