Allow iterators instead of requiring slices that will get turned into iterators

This commit is contained in:
Oli Scherer 2022-11-17 13:00:35 +00:00
parent 3597ed5a09
commit c7828221e3
3 changed files with 3 additions and 3 deletions

View file

@ -59,7 +59,7 @@ fn is_impl_not_trait_with_bool_out(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
) )
}) })
.map_or(false, |assoc_item| { .map_or(false, |assoc_item| {
let proj = cx.tcx.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(ty, &[])); let proj = cx.tcx.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(ty, []));
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj); let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
nty.is_bool() nty.is_bool()

View file

@ -1263,7 +1263,7 @@ fn replace_types<'tcx>(
let item_def_id = projection_predicate.projection_ty.item_def_id; let item_def_id = projection_predicate.projection_ty.item_def_id;
let assoc_item = cx.tcx.associated_item(item_def_id); let assoc_item = cx.tcx.associated_item(item_def_id);
let projection = cx.tcx let projection = cx.tcx
.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(new_ty, &[])); .mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(new_ty, []));
if let Ok(projected_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, projection) if let Ok(projected_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, projection)
&& substs[term_param_ty.index as usize] != ty::GenericArg::from(projected_ty) && substs[term_param_ty.index as usize] != ty::GenericArg::from(projected_ty)

View file

@ -79,7 +79,7 @@ pub fn get_associated_type<'tcx>(
.associated_items(trait_id) .associated_items(trait_id)
.find_by_name_and_kind(cx.tcx, Ident::from_str(name), ty::AssocKind::Type, trait_id) .find_by_name_and_kind(cx.tcx, Ident::from_str(name), ty::AssocKind::Type, trait_id)
.and_then(|assoc| { .and_then(|assoc| {
let proj = cx.tcx.mk_projection(assoc.def_id, cx.tcx.mk_substs_trait(ty, &[])); let proj = cx.tcx.mk_projection(assoc.def_id, cx.tcx.mk_substs_trait(ty, []));
cx.tcx.try_normalize_erasing_regions(cx.param_env, proj).ok() cx.tcx.try_normalize_erasing_regions(cx.param_env, proj).ok()
}) })
} }