Skip to content

Commit 9a3b0a0

Browse files
committed
Auto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995
rustup rust-lang/rust#71292 cc rust-lang/rust#71608 --- changelog: none
2 parents 2c4d566 + bdc9528 commit 9a3b0a0

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

clippy_lints/src/escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
7777

7878
let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
7979
cx.tcx.infer_ctxt().enter(|infcx| {
80-
ExprUseVisitor::new(&mut v, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables).consume_body(body);
80+
ExprUseVisitor::new(&mut v, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
8181
});
8282

8383
for node in v.set {

clippy_lints/src/functions.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,12 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
489489
}
490490
let def_id = pat.hir_id.owner.to_def_id();
491491
if cx.tcx.has_typeck_tables(def_id) {
492-
is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
492+
is_mutable_ty(
493+
cx,
494+
&cx.tcx.typeck_tables_of(def_id.expect_local()).pat_ty(pat),
495+
pat.span,
496+
tys,
497+
)
493498
} else {
494499
false
495500
}
@@ -606,7 +611,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
606611
if self.cx.tcx.has_typeck_tables(def_id)
607612
&& is_mutable_ty(
608613
self.cx,
609-
self.cx.tcx.typeck_tables_of(def_id).expr_ty(arg),
614+
self.cx.tcx.typeck_tables_of(def_id.expect_local()).expr_ty(arg),
610615
arg.span,
611616
&mut tys,
612617
)

clippy_lints/src/loops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ fn check_for_mutation(
16951695
};
16961696
let def_id = body.hir_id.owner.to_def_id();
16971697
cx.tcx.infer_ctxt().enter(|infcx| {
1698-
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
1698+
ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(body);
16991699
});
17001700
delegate.mutation_span()
17011701
}

clippy_lints/src/needless_pass_by_value.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
135135
} = {
136136
let mut ctx = MovedVariablesCtxt::default();
137137
cx.tcx.infer_ctxt().enter(|infcx| {
138-
euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables)
139-
.consume_body(body);
138+
euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
140139
});
141140
ctx
142141
};

clippy_lints/src/utils/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
293293
hir::QPath::Resolved(_, path) => path.res,
294294
hir::QPath::TypeRelative(..) => {
295295
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
296-
cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
296+
cx.tcx
297+
.typeck_tables_of(id.owner.to_def_id().expect_local())
298+
.qpath_res(qpath, id)
297299
} else {
298300
Res::Err
299301
}
@@ -436,7 +438,7 @@ pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[&str]) -> Option<Vec
436438
pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
437439
cx.tcx
438440
.entry_fn(LOCAL_CRATE)
439-
.map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id)
441+
.map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id.to_def_id())
440442
}
441443

442444
/// Gets the name of the item the expression is in, if available.

clippy_lints/src/utils/usage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
1919
};
2020
let def_id = expr.hir_id.owner.to_def_id();
2121
cx.tcx.infer_ctxt().enter(|infcx| {
22-
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
22+
ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(expr);
2323
});
2424

2525
if delegate.skip {

clippy_lints/src/wildcard_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl LateLintPass<'_, '_> for WildcardImports {
8585
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
8686
// don't lint prelude glob imports
8787
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
88-
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
88+
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner);
8989
if !used_imports.is_empty(); // Already handled by `unused_imports`
9090
then {
9191
let mut applicability = Applicability::MachineApplicable;

0 commit comments

Comments
 (0)