Skip to content

Commit fe129a0

Browse files
committed
Merge from rustc
2 parents a937f49 + d048c11 commit fe129a0

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
122122

123123
let sized_trait = need!(cx.tcx.lang_items().sized_trait());
124124

125-
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds().iter())
125+
let preds = traits::elaborate(cx.tcx, cx.param_env.caller_bounds().iter())
126126
.filter(|p| !p.is_global())
127127
.filter_map(|pred| {
128128
// Note that we do not want to deal with qualified predicates here.

clippy_lints/src/redundant_static_lifetimes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::msrvs::{self, Msrv};
33
use clippy_utils::source::snippet;
4-
use rustc_ast::ast::{Item, ItemKind, Ty, TyKind};
4+
use rustc_ast::ast::{Item, ItemKind, Ty, TyKind, StaticItem, ConstItem};
55
use rustc_errors::Applicability;
66
use rustc_lint::{EarlyContext, EarlyLintPass};
77
use rustc_session::{declare_tool_lint, impl_lint_pass};
@@ -100,13 +100,13 @@ impl EarlyLintPass for RedundantStaticLifetimes {
100100
}
101101

102102
if !item.span.from_expansion() {
103-
if let ItemKind::Const(_, ref var_type, _) = item.kind {
103+
if let ItemKind::Const(box ConstItem { ty: ref var_type, .. }) = item.kind {
104104
Self::visit_type(var_type, cx, "constants have by default a `'static` lifetime");
105105
// Don't check associated consts because `'static` cannot be elided on those (issue
106106
// #2438)
107107
}
108108

109-
if let ItemKind::Static(ref var_type, _, _) = item.kind {
109+
if let ItemKind::Static(box StaticItem { ty: ref var_type,.. }) = item.kind {
110110
Self::visit_type(var_type, cx, "statics have by default a `'static` lifetime");
111111
}
112112
}

clippy_utils/src/ast_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
286286
match (l, r) {
287287
(ExternCrate(l), ExternCrate(r)) => l == r,
288288
(Use(l), Use(r)) => eq_use_tree(l, r),
289-
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
290-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
289+
(Static(box ast::StaticItem { ty: lt, mutability: lm, expr: le}), Static(box ast::StaticItem { ty: rt, mutability: rm, expr: re})) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
290+
(Const(box ast::ConstItem { defaultness: ld, ty: lt, expr: le}), Const(box ast::ConstItem { defaultness: rd, ty: rt, expr: re} )) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
291291
(
292292
Fn(box ast::Fn {
293293
defaultness: ld,
@@ -451,7 +451,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
451451
pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
452452
use AssocItemKind::*;
453453
match (l, r) {
454-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
454+
(Const(box ast::ConstItem { defaultness: ld, ty: lt, expr: le}), Const(box ast::ConstItem { defaultness: rd, ty: rt, expr: re})) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
455455
(
456456
Fn(box ast::Fn {
457457
defaultness: ld,

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,7 @@ pub fn fn_has_unsatisfiable_preds(cx: &LateContext<'_>, did: DefId) -> bool {
21042104
.filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None });
21052105
traits::impossible_predicates(
21062106
cx.tcx,
2107-
traits::elaborate_predicates(cx.tcx, predicates)
2107+
traits::elaborate(cx.tcx, predicates)
21082108
.collect::<Vec<_>>(),
21092109
)
21102110
}

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ fn check_terminator<'tcx>(
301301
| TerminatorKind::Goto { .. }
302302
| TerminatorKind::Return
303303
| TerminatorKind::Resume
304+
| TerminatorKind::Terminate
304305
| TerminatorKind::Unreachable => Ok(()),
305306

306307
TerminatorKind::Drop { place, .. } => check_place(tcx, *place, span, body),
307308

308309
TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body),
309310

310-
TerminatorKind::Abort => Err((span, "abort is not stable in const fn".into())),
311311
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
312312
Err((span, "const fn generators are unstable".into()))
313313
},
@@ -318,7 +318,7 @@ fn check_terminator<'tcx>(
318318
from_hir_call: _,
319319
destination: _,
320320
target: _,
321-
cleanup: _,
321+
unwind: _,
322322
fn_span: _,
323323
} => {
324324
let fn_ty = func.ty(body, tcx);
@@ -361,7 +361,7 @@ fn check_terminator<'tcx>(
361361
expected: _,
362362
msg: _,
363363
target: _,
364-
cleanup: _,
364+
unwind: _,
365365
} => check_operand(tcx, cond, span, body),
366366

367367
TerminatorKind::InlineAsm { .. } => Err((span, "cannot use inline assembly in const fn".into())),

0 commit comments

Comments
 (0)