Skip to content

Commit ec1d61e

Browse files
committed
Auto merge of rust-lang#114481 - matthiaskrgr:rollup-58pczpl, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#113945 (Fix wrong span for trait selection failure error reporting) - rust-lang#114351 ([rustc_span][perf] Remove unnecessary string joins and allocs.) - rust-lang#114418 (bump parking_lot to 0.12) - rust-lang#114434 (Improve spans for indexing expressions) - rust-lang#114450 (Fix ICE failed to get layout for ReferencesError) - rust-lang#114461 (Fix unwrap on None) - rust-lang#114462 (interpret: add mplace_to_ref helper method) - rust-lang#114472 (Reword `confusable_idents` lint) - rust-lang#114477 (Account for `Rc` and `Arc` when suggesting to clone) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1852200 + 878a87d commit ec1d61e

33 files changed

+42
-42
lines changed

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ fn in_postfix_position<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> boo
800800
&& parent.span.ctxt() == e.span.ctxt()
801801
{
802802
match parent.kind {
803-
ExprKind::Call(child, _) | ExprKind::MethodCall(_, child, _, _) | ExprKind::Index(child, _)
803+
ExprKind::Call(child, _) | ExprKind::MethodCall(_, child, _, _) | ExprKind::Index(child, _, _)
804804
if child.hir_id == e.hir_id => true,
805805
ExprKind::Field(_, _) | ExprKind::Match(_, _, MatchSource::TryDesugar | MatchSource::AwaitDesugar) => true,
806806
_ => false,

clippy_lints/src/functions/must_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn is_mutated_static(e: &hir::Expr<'_>) -> bool {
221221
match e.kind {
222222
Path(QPath::Resolved(_, path)) => !matches!(path.res, Res::Local(_)),
223223
Path(_) => true,
224-
Field(inner, _) | Index(inner, _) => is_mutated_static(inner),
224+
Field(inner, _) | Index(inner, _, _) => is_mutated_static(inner),
225225
_ => false,
226226
}
227227
}

clippy_lints/src/index_refutable_slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
254254
// Checking for slice indexing
255255
let parent_id = map.parent_id(expr.hir_id);
256256
if let Some(hir::Node::Expr(parent_expr)) = map.find(parent_id);
257-
if let hir::ExprKind::Index(_, index_expr) = parent_expr.kind;
257+
if let hir::ExprKind::Index(_, index_expr, _) = parent_expr.kind;
258258
if let Some(Constant::Int(index_value)) = constant(cx, cx.typeck_results(), index_expr);
259259
if let Ok(index_value) = index_value.try_into();
260260
if index_value < max_suggested_slice;

clippy_lints/src/indexing_slicing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
103103
return;
104104
}
105105

106-
if let ExprKind::Index(array, index) = &expr.kind {
106+
if let ExprKind::Index(array, index, _) = &expr.kind {
107107
let note = "the suggestion might not be applicable in constant blocks";
108108
let ty = cx.typeck_results().expr_ty(array).peel_refs();
109109
if let Some(range) = higher::Range::hir(index) {

clippy_lints/src/loops/manual_memcpy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub(super) fn check<'tcx>(
6060
o.and_then(|(lhs, rhs)| {
6161
let rhs = fetch_cloned_expr(rhs);
6262
if_chain! {
63-
if let ExprKind::Index(base_left, idx_left) = lhs.kind;
64-
if let ExprKind::Index(base_right, idx_right) = rhs.kind;
63+
if let ExprKind::Index(base_left, idx_left, _) = lhs.kind;
64+
if let ExprKind::Index(base_right, idx_right, _) = rhs.kind;
6565
if let Some(ty) = get_slice_like_element_ty(cx, cx.typeck_results().expr_ty(base_left));
6666
if get_slice_like_element_ty(cx, cx.typeck_results().expr_ty(base_right)).is_some();
6767
if let Some((start_left, offset_left)) = get_details_from_idx(cx, idx_left, &starts);

clippy_lints/src/loops/needless_range_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
319319

320320
if_chain! {
321321
// an index op
322-
if let ExprKind::Index(seqexpr, idx) = expr.kind;
322+
if let ExprKind::Index(seqexpr, idx, _) = expr.kind;
323323
if !self.check(idx, seqexpr, expr);
324324
then {
325325
return;

clippy_lints/src/loops/never_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn never_loop_expr<'tcx>(
162162
ExprKind::Binary(_, e1, e2)
163163
| ExprKind::Assign(e1, e2, _)
164164
| ExprKind::AssignOp(_, e1, e2)
165-
| ExprKind::Index(e1, e2) => never_loop_expr_all(cx, &mut [e1, e2].iter().copied(), ignore_ids, main_loop_id),
165+
| ExprKind::Index(e1, e2, _) => never_loop_expr_all(cx, &mut [e1, e2].iter().copied(), ignore_ids, main_loop_id),
166166
ExprKind::Loop(b, _, _, _) => {
167167
// Break can come from the inner loop so remove them.
168168
absorb_break(never_loop_block(cx, b, ignore_ids, main_loop_id))

clippy_lints/src/loops/while_let_on_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn try_parse_iter_expr(cx: &LateContext<'_>, mut e: &Expr<'_>) -> Option<IterExp
113113

114114
// Shouldn't have side effects, but there's no way to trace which field is used. So forget which fields have
115115
// already been seen.
116-
ExprKind::Index(base, idx) if !idx.can_have_side_effects() => {
116+
ExprKind::Index(base, idx, _) if !idx.can_have_side_effects() => {
117117
can_move = false;
118118
fields.clear();
119119
e = base;

clippy_lints/src/manual_strip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn find_stripping<'tcx>(
204204
if_chain! {
205205
if is_ref_str(self.cx, ex);
206206
let unref = peel_ref(ex);
207-
if let ExprKind::Index(indexed, index) = &unref.kind;
207+
if let ExprKind::Index(indexed, index, _) = &unref.kind;
208208
if let Some(higher::Range { start, end, .. }) = higher::Range::hir(index);
209209
if let ExprKind::Path(path) = &indexed.kind;
210210
if self.cx.qpath_res(path, ex.hir_id) == self.target;

clippy_lints/src/matches/match_on_vec_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::MATCH_ON_VEC_ITEMS;
1212
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, scrutinee: &'tcx Expr<'_>) {
1313
if_chain! {
1414
if let Some(idx_expr) = is_vec_indexing(cx, scrutinee);
15-
if let ExprKind::Index(vec, idx) = idx_expr.kind;
15+
if let ExprKind::Index(vec, idx, _) = idx_expr.kind;
1616

1717
then {
1818
// FIXME: could be improved to suggest surrounding every pattern with Some(_),
@@ -36,7 +36,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, scrutinee: &'tcx Expr<'_>) {
3636

3737
fn is_vec_indexing<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> {
3838
if_chain! {
39-
if let ExprKind::Index(array, index) = expr.kind;
39+
if let ExprKind::Index(array, index, _) = expr.kind;
4040
if is_vector(cx, array);
4141
if !is_full_range(cx, index);
4242

clippy_lints/src/methods/filter_next.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::FILTER_NEXT;
1212
fn path_to_local(expr: &hir::Expr<'_>) -> Option<hir::HirId> {
1313
match expr.kind {
1414
hir::ExprKind::Field(f, _) => path_to_local(f),
15-
hir::ExprKind::Index(recv, _) => path_to_local(recv),
15+
hir::ExprKind::Index(recv, _, _) => path_to_local(recv),
1616
hir::ExprKind::Path(hir::QPath::Resolved(
1717
_,
1818
hir::Path {

clippy_lints/src/methods/iter_next_slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, cal
2727
if derefs_to_slice(cx, caller_expr, cx.typeck_results().expr_ty(caller_expr)).is_some() {
2828
// caller is a Slice
2929
if_chain! {
30-
if let hir::ExprKind::Index(caller_var, index_expr) = &caller_expr.kind;
30+
if let hir::ExprKind::Index(caller_var, index_expr, _) = &caller_expr.kind;
3131
if let Some(higher::Range { start: Some(start_expr), end: None, limits: ast::RangeLimits::HalfOpen })
3232
= higher::Range::hir(index_expr);
3333
if let hir::ExprKind::Lit(start_lit) = &start_expr.kind;

clippy_lints/src/mixed_read_write_in_expression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn check_expr<'tcx>(vis: &mut ReadVisitor<'_, 'tcx>, expr: &'tcx Expr<'_>) -> St
239239
| ExprKind::MethodCall(..)
240240
| ExprKind::Call(_, _)
241241
| ExprKind::Assign(..)
242-
| ExprKind::Index(_, _)
242+
| ExprKind::Index(..)
243243
| ExprKind::Repeat(_, _)
244244
| ExprKind::Struct(_, _, _) => {
245245
walk_expr(vis, expr);

clippy_lints/src/needless_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn condition_needs_parentheses(e: &Expr<'_>) -> bool {
119119
| ExprKind::Call(i, _)
120120
| ExprKind::Cast(i, _)
121121
| ExprKind::Type(i, _)
122-
| ExprKind::Index(i, _) = inner.kind
122+
| ExprKind::Index(i, _, _) = inner.kind
123123
{
124124
if matches!(
125125
i.kind,

clippy_lints/src/no_effect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
160160
match peel_blocks(expr).kind {
161161
ExprKind::Lit(..) | ExprKind::Closure { .. } => true,
162162
ExprKind::Path(..) => !has_drop(cx, cx.typeck_results().expr_ty(expr)),
163-
ExprKind::Index(a, b) | ExprKind::Binary(_, a, b) => has_no_effect(cx, a) && has_no_effect(cx, b),
163+
ExprKind::Index(a, b, _) | ExprKind::Binary(_, a, b) => has_no_effect(cx, a) && has_no_effect(cx, b),
164164
ExprKind::Array(v) | ExprKind::Tup(v) => v.iter().all(|val| has_no_effect(cx, val)),
165165
ExprKind::Repeat(inner, _)
166166
| ExprKind::Cast(inner, _)
@@ -263,7 +263,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec
263263
return None;
264264
}
265265
match expr.kind {
266-
ExprKind::Index(a, b) => Some(vec![a, b]),
266+
ExprKind::Index(a, b, _) => Some(vec![a, b]),
267267
ExprKind::Binary(ref binop, a, b) if binop.node != BinOpKind::And && binop.node != BinOpKind::Or => {
268268
Some(vec![a, b])
269269
},

clippy_lints/src/non_copy_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
438438

439439
dereferenced_expr = parent_expr;
440440
},
441-
ExprKind::Index(e, _) if ptr::eq(&**e, cur_expr) => {
441+
ExprKind::Index(e, _, _) if ptr::eq(&**e, cur_expr) => {
442442
// `e[i]` => desugared to `*Index::index(&e, i)`,
443443
// meaning `e` must be referenced.
444444
// no need to go further up since a method call is involved now.

clippy_lints/src/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ fn check_ptr_arg_usage<'tcx>(cx: &LateContext<'tcx>, body: &'tcx Body<'_>, args:
695695
}
696696
},
697697
// Indexing is fine for currently supported types.
698-
ExprKind::Index(e, _) if e.hir_id == child_id => (),
698+
ExprKind::Index(e, _, _) if e.hir_id == child_id => (),
699699
_ => set_skip_flag(),
700700
},
701701
_ => set_skip_flag(),

clippy_lints/src/redundant_slicing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
8181
if_chain! {
8282
if let ExprKind::AddrOf(BorrowKind::Ref, mutability, addressee) = expr.kind;
8383
if addressee.span.ctxt() == ctxt;
84-
if let ExprKind::Index(indexed, range) = addressee.kind;
84+
if let ExprKind::Index(indexed, range, _) = addressee.kind;
8585
if is_type_lang_item(cx, cx.typeck_results().expr_ty_adjusted(range), LangItem::RangeFull);
8686
then {
8787
let (expr_ty, expr_ref_count) = peel_mid_ty_refs(cx.typeck_results().expr_ty(expr));

clippy_lints/src/strings.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for StringAdd {
190190
);
191191
}
192192
},
193-
ExprKind::Index(target, _idx) => {
193+
ExprKind::Index(target, _idx, _) => {
194194
let e_ty = cx.typeck_results().expr_ty(target).peel_refs();
195195
if e_ty.is_str() || is_type_lang_item(cx, e_ty, LangItem::String) {
196196
span_lint(
@@ -262,7 +262,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
262262

263263
// Find string::as_bytes
264264
if let ExprKind::AddrOf(BorrowKind::Ref, _, args) = args[0].kind;
265-
if let ExprKind::Index(left, right) = args.kind;
265+
if let ExprKind::Index(left, right, _) = args.kind;
266266
let (method_names, expressions, _) = method_calls(left, 1);
267267
if method_names.len() == 1;
268268
if expressions.len() == 1;

clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ fn ident_difference_expr_with_base_location(
572572
| (AddrOf(_, _, _), AddrOf(_, _, _))
573573
| (Path(_, _), Path(_, _))
574574
| (Range(_, _, _), Range(_, _, _))
575-
| (Index(_, _), Index(_, _))
575+
| (Index(_, _, _), Index(_, _, _))
576576
| (Field(_, _), Field(_, _))
577577
| (AssignOp(_, _, _), AssignOp(_, _, _))
578578
| (Assign(_, _, _), Assign(_, _, _))

clippy_lints/src/swap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ fn generate_swap_warning(cx: &LateContext<'_>, e1: &Expr<'_>, e2: &Expr<'_>, spa
8686
let mut applicability = Applicability::MachineApplicable;
8787

8888
if !can_mut_borrow_both(cx, e1, e2) {
89-
if let ExprKind::Index(lhs1, idx1) = e1.kind
90-
&& let ExprKind::Index(lhs2, idx2) = e2.kind
89+
if let ExprKind::Index(lhs1, idx1, _) = e1.kind
90+
&& let ExprKind::Index(lhs2, idx2, _) = e2.kind
9191
&& eq_expr_value(cx, lhs1, lhs2)
9292
&& e1.span.ctxt() == ctxt
9393
&& e2.span.ctxt() == ctxt

clippy_lints/src/temporary_assignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'tcx> LateLintPass<'tcx> for TemporaryAssignment {
3333
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
3434
if let ExprKind::Assign(target, ..) = &expr.kind {
3535
let mut base = target;
36-
while let ExprKind::Field(f, _) | ExprKind::Index(f, _) = &base.kind {
36+
while let ExprKind::Field(f, _) | ExprKind::Index(f, _, _) = &base.kind {
3737
base = f;
3838
}
3939
if is_temporary(base) && !is_adjusted(cx, base) {

clippy_lints/src/tuple_array_conversions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ fn check_tuple<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, elements: &
103103
// Fix #11100
104104
&& tys.iter().all_equal()
105105
&& let Some(locals) = (match first.kind {
106-
ExprKind::Index(_, _) => elements
106+
ExprKind::Index(..) => elements
107107
.iter()
108108
.enumerate()
109109
.map(|(i, i_expr)| -> Option<&'tcx Expr<'tcx>> {
110-
if let ExprKind::Index(lhs, index) = i_expr.kind
110+
if let ExprKind::Index(lhs, index, _) = i_expr.kind
111111
&& let ExprKind::Lit(lit) = index.kind
112112
&& let LitKind::Int(val, _) = lit.node
113113
{

clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
526526
self.ident(field_name);
527527
self.expr(object);
528528
},
529-
ExprKind::Index(object, index) => {
529+
ExprKind::Index(object, index, _) => {
530530
bind!(self, object, index);
531531
kind!("Index({object}, {index})");
532532
self.expr(object);

clippy_lints/src/vec_init_then_push.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl VecPushSearcher {
8888
let mut last_place = parent;
8989
while let Some(parent) = get_parent_expr(cx, last_place) {
9090
if matches!(parent.kind, ExprKind::Unary(UnOp::Deref, _) | ExprKind::Field(..))
91-
|| matches!(parent.kind, ExprKind::Index(e, _) if e.hir_id == last_place.hir_id)
91+
|| matches!(parent.kind, ExprKind::Index(e, _, _) if e.hir_id == last_place.hir_id)
9292
{
9393
last_place = parent;
9494
} else {

clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
178178
(Yield(l), Yield(r)) | (Ret(l), Ret(r)) => eq_expr_opt(l, r),
179179
(Break(ll, le), Break(rl, re)) => eq_label(ll, rl) && eq_expr_opt(le, re),
180180
(Continue(ll), Continue(rl)) => eq_label(ll, rl),
181-
(Assign(l1, l2, _), Assign(r1, r2, _)) | (Index(l1, l2), Index(r1, r2)) => eq_expr(l1, r1) && eq_expr(l2, r2),
181+
(Assign(l1, l2, _), Assign(r1, r2, _)) | (Index(l1, l2, _), Index(r1, r2, _)) => eq_expr(l1, r1) && eq_expr(l2, r2),
182182
(AssignOp(lo, lp, lv), AssignOp(ro, rp, rv)) => lo.node == ro.node && eq_expr(lp, rp) && eq_expr(lv, rv),
183183
(Field(lp, lf), Field(rp, rf)) => eq_id(*lf, *rf) && eq_expr(lp, rp),
184184
(Match(ls, la), Match(rs, ra)) => eq_expr(ls, rs) && over(la, ra, eq_arm),

clippy_utils/src/check_proc_macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ fn expr_search_pat(tcx: TyCtxt<'_>, e: &Expr<'_>) -> (Pat, Pat) {
163163
) => (Pat::Str("unsafe"), Pat::Str("}")),
164164
ExprKind::Block(_, None) => (Pat::Str("{"), Pat::Str("}")),
165165
ExprKind::Field(e, name) => (expr_search_pat(tcx, e).0, Pat::Sym(name.name)),
166-
ExprKind::Index(e, _) => (expr_search_pat(tcx, e).0, Pat::Str("]")),
166+
ExprKind::Index(e, _, _) => (expr_search_pat(tcx, e).0, Pat::Str("]")),
167167
ExprKind::Path(ref path) => qpath_search_pat(path),
168168
ExprKind::AddrOf(_, _, e) => (Pat::Str("&"), expr_search_pat(tcx, e).1),
169169
ExprKind::Break(Destination { label: None, .. }, None) => (Pat::Str("break"), Pat::Str("break")),

clippy_utils/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
394394
}
395395
}
396396
},
397-
ExprKind::Index(arr, index) => self.index(arr, index),
397+
ExprKind::Index(arr, index, _) => self.index(arr, index),
398398
ExprKind::AddrOf(_, _, inner) => self.expr(inner).map(|r| Constant::Ref(Box::new(r))),
399399
ExprKind::Field(local_expr, ref field) => {
400400
let result = self.expr(local_expr);

clippy_utils/src/eager_or_lazy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
185185
.type_dependent_def_id(e.hir_id)
186186
.map_or(Lazy, |id| fn_eagerness(self.cx, id, name.ident.name, true));
187187
},
188-
ExprKind::Index(_, e) => {
188+
ExprKind::Index(_, e, _) => {
189189
let ty = self.cx.typeck_results().expr_ty_adjusted(e);
190190
if is_copy(self.cx, ty) && !ty.is_ref() {
191191
self.eagerness |= NoChange;

clippy_utils/src/hir_utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl HirEqInterExpr<'_, '_, '_> {
299299
(&ExprKind::Field(l_f_exp, ref l_f_ident), &ExprKind::Field(r_f_exp, ref r_f_ident)) => {
300300
l_f_ident.name == r_f_ident.name && self.eq_expr(l_f_exp, r_f_exp)
301301
},
302-
(&ExprKind::Index(la, li), &ExprKind::Index(ra, ri)) => self.eq_expr(la, ra) && self.eq_expr(li, ri),
302+
(&ExprKind::Index(la, li, _), &ExprKind::Index(ra, ri, _)) => self.eq_expr(la, ra) && self.eq_expr(li, ri),
303303
(&ExprKind::If(lc, lt, ref le), &ExprKind::If(rc, rt, ref re)) => {
304304
self.eq_expr(lc, rc) && self.eq_expr(lt, rt) && both(le, re, |l, r| self.eq_expr(l, r))
305305
},
@@ -730,7 +730,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
730730
self.hash_expr(e);
731731
self.hash_name(f.name);
732732
},
733-
ExprKind::Index(a, i) => {
733+
ExprKind::Index(a, i, _) => {
734734
self.hash_expr(a);
735735
self.hash_expr(i);
736736
},

clippy_utils/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ fn projection_stack<'a, 'hir>(mut e: &'a Expr<'hir>) -> (Vec<&'a Expr<'hir>>, &'
735735
let mut result = vec![];
736736
let root = loop {
737737
match e.kind {
738-
ExprKind::Index(ep, _) | ExprKind::Field(ep, _) => {
738+
ExprKind::Index(ep, _, _) | ExprKind::Field(ep, _) => {
739739
result.push(e);
740740
e = ep;
741741
},
@@ -782,7 +782,7 @@ pub fn can_mut_borrow_both(cx: &LateContext<'_>, e1: &Expr<'_>, e2: &Expr<'_>) -
782782
return true;
783783
}
784784
},
785-
(ExprKind::Index(_, i1), ExprKind::Index(_, i2)) => {
785+
(ExprKind::Index(_, i1, _), ExprKind::Index(_, i2, _)) => {
786786
if !eq_expr_value(cx, i1, i2) {
787787
return false;
788788
}

clippy_utils/src/ty/type_certainty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty {
3131
let certainty = match &expr.kind {
3232
ExprKind::Unary(_, expr)
3333
| ExprKind::Field(expr, _)
34-
| ExprKind::Index(expr, _)
34+
| ExprKind::Index(expr, _, _)
3535
| ExprKind::AddrOf(_, _, expr) => expr_type_certainty(cx, expr),
3636

3737
ExprKind::Array(exprs) => join(exprs.iter().map(|expr| expr_type_certainty(cx, expr))),

clippy_utils/src/visitors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ pub fn is_const_evaluatable<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) ->
329329
&& self.cx.typeck_results().expr_ty(rhs).peel_refs().is_primitive_ty() => {},
330330
ExprKind::Unary(UnOp::Deref, e) if self.cx.typeck_results().expr_ty(e).is_ref() => (),
331331
ExprKind::Unary(_, e) if self.cx.typeck_results().expr_ty(e).peel_refs().is_primitive_ty() => (),
332-
ExprKind::Index(base, _)
332+
ExprKind::Index(base, _, _)
333333
if matches!(
334334
self.cx.typeck_results().expr_ty(base).peel_refs().kind(),
335335
ty::Slice(_) | ty::Array(..)
@@ -629,7 +629,7 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
629629
helper(typeck, true, arg, f)?;
630630
}
631631
},
632-
ExprKind::Index(borrowed, consumed)
632+
ExprKind::Index(borrowed, consumed, _)
633633
| ExprKind::Assign(borrowed, consumed, _)
634634
| ExprKind::AssignOp(_, borrowed, consumed) => {
635635
helper(typeck, false, borrowed, f)?;

0 commit comments

Comments
 (0)