Skip to content

Commit 6b20030

Browse files
committed
Auto merge of #111342 - Dylan-DPC:rollup-b5p6wzy, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #110297 (Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder`) - #110827 (Fix lifetime suggestion for type aliases with objects in them) - #111022 (Use smaller ints for bitflags) - #111056 (Fix some suggestions where a `Box<T>` is expected.) - #111262 (Further normalize msvc-non-utf8-ouput) - #111265 (Make generics_of has_self on RPITITs delegate to the opaque) - #111323 (Give a more helpful error when running the rustc shim directly) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents e7b4ad2 + b143086 commit 6b20030

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
385385
Node::Expr(parent_expr) => {
386386
if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr)
387387
{
388+
// FIXME: the `subst_identity()` below seems incorrect, since we eventually
389+
// call `tcx.try_subst_and_normalize_erasing_regions` further down
390+
// (i.e., we are explicitly not in the identity context).
388391
let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder();
389392
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
390393
&& let Some(param_ty) = fn_sig.inputs().get(arg_index)
@@ -435,7 +438,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
435438
let output_ty = fn_sig.output();
436439
if output_ty.contains(*param_ty) {
437440
if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions(
438-
new_subst, cx.param_env, output_ty) {
441+
new_subst, cx.param_env, EarlyBinder(output_ty)) {
439442
expr = parent_expr;
440443
ty = new_ty;
441444
continue;

0 commit comments

Comments
 (0)