Auto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995

rustup https://github.com/rust-lang/rust/pull/71292/

cc https://github.com/rust-lang/rust/issues/71608

---

changelog: none
This commit is contained in:
bors 2020-04-28 18:30:01 +00:00
commit 9a3b0a0588
7 changed files with 16 additions and 10 deletions

View File

@ -77,7 +77,7 @@ fn check_fn(
let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
cx.tcx.infer_ctxt().enter(|infcx| {
ExprUseVisitor::new(&mut v, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables).consume_body(body);
ExprUseVisitor::new(&mut v, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
});
for node in v.set {

View File

@ -489,7 +489,12 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
}
let def_id = pat.hir_id.owner.to_def_id();
if cx.tcx.has_typeck_tables(def_id) {
is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
is_mutable_ty(
cx,
&cx.tcx.typeck_tables_of(def_id.expect_local()).pat_ty(pat),
pat.span,
tys,
)
} else {
false
}
@ -606,7 +611,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {
if self.cx.tcx.has_typeck_tables(def_id)
&& is_mutable_ty(
self.cx,
self.cx.tcx.typeck_tables_of(def_id).expr_ty(arg),
self.cx.tcx.typeck_tables_of(def_id.expect_local()).expr_ty(arg),
arg.span,
&mut tys,
)

View File

@ -1695,7 +1695,7 @@ fn check_for_mutation(
};
let def_id = body.hir_id.owner.to_def_id();
cx.tcx.infer_ctxt().enter(|infcx| {
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(body);
});
delegate.mutation_span()
}

View File

@ -135,8 +135,7 @@ fn check_fn(
} = {
let mut ctx = MovedVariablesCtxt::default();
cx.tcx.infer_ctxt().enter(|infcx| {
euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id.to_def_id(), cx.param_env, cx.tables)
.consume_body(body);
euv::ExprUseVisitor::new(&mut ctx, &infcx, fn_def_id, cx.param_env, cx.tables).consume_body(body);
});
ctx
};

View File

@ -293,7 +293,9 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
hir::QPath::Resolved(_, path) => path.res,
hir::QPath::TypeRelative(..) => {
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
cx.tcx
.typeck_tables_of(id.owner.to_def_id().expect_local())
.qpath_res(qpath, id)
} else {
Res::Err
}
@ -436,7 +438,7 @@ pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[&str]) -> Option<Vec
pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
cx.tcx
.entry_fn(LOCAL_CRATE)
.map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id)
.map_or(false, |(entry_fn_def_id, _)| def_id == entry_fn_def_id.to_def_id())
}
/// Gets the name of the item the expression is in, if available.

View File

@ -19,7 +19,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
};
let def_id = expr.hir_id.owner.to_def_id();
cx.tcx.infer_ctxt().enter(|infcx| {
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
ExprUseVisitor::new(&mut delegate, &infcx, def_id.expect_local(), cx.param_env, cx.tables).walk_expr(expr);
});
if delegate.skip {

View File

@ -85,7 +85,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item<'_>) {
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
// don't lint prelude glob imports
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner);
if !used_imports.is_empty(); // Already handled by `unused_imports`
then {
let mut applicability = Applicability::MachineApplicable;