Effects cleanup

- removed extra bits from predicates queries that are no longer needed in the new system
- removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
This commit is contained in:
Deadbeef 2024-10-26 10:18:42 +08:00
parent a1ff955721
commit 350d1c4aee

View File

@ -324,7 +324,7 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
// If the current self type doesn't implement Copy (due to generic constraints), search to see if // If the current self type doesn't implement Copy (due to generic constraints), search to see if
// there's a Copy impl for any instance of the adt. // there's a Copy impl for any instance of the adt.
if !is_copy(cx, ty) { if !is_copy(cx, ty) {
if ty_subs.non_erasable_generics(cx.tcx, ty_adt.did()).next().is_some() { if ty_subs.non_erasable_generics().next().is_some() {
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| { let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
impls.iter().any(|&id| { impls.iter().any(|&id| {
matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _) matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _)