changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods
This commit is contained in:
parent
e4f6b8b43b
commit
d27f40175f
@ -586,7 +586,7 @@ impl<'tcx> Instance<'tcx> {
|
|||||||
if let Some(substs) = self.substs_for_mir_body() {
|
if let Some(substs) = self.substs_for_mir_body() {
|
||||||
v.subst(tcx, substs)
|
v.subst(tcx, substs)
|
||||||
} else {
|
} else {
|
||||||
v.subst_identity()
|
v.skip_binder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ impl<'tcx> Instance<'tcx> {
|
|||||||
if let Some(substs) = self.substs_for_mir_body() {
|
if let Some(substs) = self.substs_for_mir_body() {
|
||||||
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
|
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
|
||||||
} else {
|
} else {
|
||||||
tcx.normalize_erasing_regions(param_env, v.subst_identity())
|
tcx.normalize_erasing_regions(param_env, v.skip_binder())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ impl<'tcx> Instance<'tcx> {
|
|||||||
if let Some(substs) = self.substs_for_mir_body() {
|
if let Some(substs) = self.substs_for_mir_body() {
|
||||||
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v)
|
tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v)
|
||||||
} else {
|
} else {
|
||||||
tcx.try_normalize_erasing_regions(param_env, v.subst_identity())
|
tcx.try_normalize_erasing_regions(param_env, v.skip_binder())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +385,9 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
|
|||||||
Node::Expr(parent_expr) => {
|
Node::Expr(parent_expr) => {
|
||||||
if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr)
|
if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr)
|
||||||
{
|
{
|
||||||
|
// FIXME: the `subst_identity()` below seems incorrect, since we eventually
|
||||||
|
// call `tcx.try_subst_and_normalize_erasing_regions` further down
|
||||||
|
// (i.e., we are explicitly not in the identity context).
|
||||||
let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder();
|
let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder();
|
||||||
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
|
if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
|
||||||
&& let Some(param_ty) = fn_sig.inputs().get(arg_index)
|
&& let Some(param_ty) = fn_sig.inputs().get(arg_index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user