Skip to content

Commit a155c38

Browse files
Split out IntoIterator and non-Iterator constructors for AliasTy/AliasTerm/TraitRef/projection
1 parent 58fc27f commit a155c38

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
6161
)
6262
})
6363
.map_or(false, |assoc_item| {
64-
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
64+
let proj = Ty::new_projection_from_args(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
6565
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
6666

6767
nty.is_bool()

clippy_lints/src/methods/needless_collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fn iterates_same_ty<'tcx>(cx: &LateContext<'tcx>, iter_ty: Ty<'tcx>, collect_ty:
206206
&& let Some(into_iter_item_proj) = make_projection(cx.tcx, into_iter_trait, sym::Item, [collect_ty])
207207
&& let Ok(into_iter_item_ty) = cx.tcx.try_normalize_erasing_regions(
208208
cx.param_env,
209-
Ty::new_projection(cx.tcx, into_iter_item_proj.def_id, into_iter_item_proj.args),
209+
Ty::new_projection_from_args(cx.tcx, into_iter_item_proj.def_id, into_iter_item_proj.args),
210210
)
211211
{
212212
iter_item_ty == into_iter_item_ty
@@ -235,7 +235,7 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
235235
iter_trait,
236236
)
237237
&& let args = cx.tcx.mk_args(&[GenericArg::from(typeck.expr_ty_adjusted(iter_expr))])
238-
&& let proj_ty = Ty::new_projection(cx.tcx, iter_item.def_id, args)
238+
&& let proj_ty = Ty::new_projection_from_args(cx.tcx, iter_item.def_id, args)
239239
&& let Ok(item_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, proj_ty)
240240
{
241241
item_ty == EarlyBinder::bind(search_ty).instantiate(cx.tcx, cx.typeck_results().node_args(call_id))

clippy_lints/src/redundant_slicing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
133133
} else if let Some(target_id) = cx.tcx.lang_items().deref_target() {
134134
if let Ok(deref_ty) = cx.tcx.try_normalize_erasing_regions(
135135
cx.param_env,
136-
Ty::new_projection(cx.tcx, target_id, cx.tcx.mk_args(&[GenericArg::from(indexed_ty)])),
136+
Ty::new_projection_from_args(cx.tcx, target_id, cx.tcx.mk_args(&[GenericArg::from(indexed_ty)])),
137137
) {
138138
if deref_ty == expr_ty {
139139
let snip = snippet_with_context(cx, indexed.span, ctxt, "..", &mut app).0;

clippy_utils/src/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
292292
let trait_ref = TraitRef::new(
293293
tcx,
294294
trait_id,
295-
Some(GenericArg::from(ty)).into_iter().chain(args).chain(effect_arg),
295+
[GenericArg::from(ty)].into_iter().chain(args).chain(effect_arg),
296296
);
297297

298298
debug_assert_matches!(
@@ -1126,7 +1126,7 @@ pub fn make_projection<'tcx>(
11261126
#[cfg(debug_assertions)]
11271127
assert_generic_args_match(tcx, assoc_item.def_id, args);
11281128

1129-
Some(AliasTy::new(tcx, assoc_item.def_id, args))
1129+
Some(AliasTy::new_from_args(tcx, assoc_item.def_id, args))
11301130
}
11311131
helper(
11321132
tcx,
@@ -1165,7 +1165,7 @@ pub fn make_normalized_projection<'tcx>(
11651165
);
11661166
return None;
11671167
}
1168-
match tcx.try_normalize_erasing_regions(param_env, Ty::new_projection(tcx, ty.def_id, ty.args)) {
1168+
match tcx.try_normalize_erasing_regions(param_env, Ty::new_projection_from_args(tcx, ty.def_id, ty.args)) {
11691169
Ok(ty) => Some(ty),
11701170
Err(e) => {
11711171
debug_assert!(false, "failed to normalize type `{ty}`: {e:#?}");
@@ -1289,7 +1289,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
12891289
.infer_ctxt()
12901290
.build()
12911291
.at(&cause, param_env)
1292-
.query_normalize(Ty::new_projection(tcx, ty.def_id, ty.args))
1292+
.query_normalize(Ty::new_projection_from_args(tcx, ty.def_id, ty.args))
12931293
{
12941294
Ok(ty) => Some(ty.value),
12951295
Err(e) => {

0 commit comments

Comments
 (0)