Skip to content

Commit d2cb227

Browse files
committed
Don't store LateContext in ConstEvalLateContext
1 parent 3779062 commit d2cb227

File tree

6 files changed

+75
-78
lines changed

6 files changed

+75
-78
lines changed

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
5151
.const_eval_poly(def_id.to_def_id())
5252
.ok()
5353
.map(|val| rustc_middle::mir::Const::from_value(val, ty));
54-
if let Some(Constant::Int(val)) = constant.and_then(|c| mir_to_const(cx, c)) {
54+
if let Some(Constant::Int(val)) = constant.and_then(|c| mir_to_const(cx.tcx, c)) {
5555
if let ty::Adt(adt, _) = ty.kind() {
5656
if adt.is_enum() {
5757
ty = adt.repr().discr_type().to_ty(cx.tcx);

clippy_lints/src/matches/overlapping_arms.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ fn all_ranges<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>], ty: Ty<'tcx>)
3737
constant(cx, cx.typeck_results(), lhs)?
3838
} else {
3939
let min_val_const = ty.numeric_min_val(cx.tcx)?;
40-
mir_to_const(cx, mir::Const::from_ty_const(min_val_const, ty, cx.tcx))?
40+
mir_to_const(cx.tcx, mir::Const::from_ty_const(min_val_const, ty, cx.tcx))?
4141
};
4242
let rhs_const = if let Some(rhs) = rhs {
4343
constant(cx, cx.typeck_results(), rhs)?
4444
} else {
4545
let max_val_const = ty.numeric_max_val(cx.tcx)?;
46-
mir_to_const(cx, mir::Const::from_ty_const(max_val_const, ty, cx.tcx))?
46+
mir_to_const(cx.tcx, mir::Const::from_ty_const(max_val_const, ty, cx.tcx))?
4747
};
4848
let lhs_val = lhs_const.int_value(cx, ty)?;
4949
let rhs_val = rhs_const.int_value(cx, ty)?;

clippy_lints/src/operators/const_comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::{IMPOSSIBLE_COMPARISONS, REDUNDANT_COMPARISONS};
2020
// Flip yoda conditionals, turnings expressions like `42 < x` into `x > 42`
2121
fn comparison_to_const<'tcx>(
2222
cx: &LateContext<'tcx>,
23-
typeck: &TypeckResults<'tcx>,
23+
typeck: &'tcx TypeckResults<'tcx>,
2424
expr: &'tcx Expr<'tcx>,
2525
) -> Option<(CmpOp, &'tcx Expr<'tcx>, &'tcx Expr<'tcx>, Constant<'tcx>, Ty<'tcx>)> {
2626
if let ExprKind::Binary(operator, left, right) = expr.kind

clippy_lints/src/operators/erasing_op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn different_types(tck: &TypeckResults<'_>, input: &Expr<'_>, output: &Expr<'_>)
3434

3535
fn check_op<'tcx>(
3636
cx: &LateContext<'tcx>,
37-
tck: &TypeckResults<'tcx>,
37+
tck: &'tcx TypeckResults<'tcx>,
3838
op: &Expr<'tcx>,
3939
other: &Expr<'tcx>,
4040
parent: &Expr<'tcx>,

0 commit comments

Comments
 (0)