Skip to content

Commit 97aa8dc

Browse files
committed
Auto merge of rust-lang#5450 - matthiaskrgr:rustup_41, r=phansch
rustup rust-lang#69745 changelog: none
2 parents 5e8c0c5 + 4352c85 commit 97aa8dc

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ fn lint_for_missing_headers<'a, 'tcx>(
229229
if let Some(body_id) = body_id;
230230
if let Some(future) = cx.tcx.lang_items().future_trait();
231231
let def_id = cx.tcx.hir().body_owner_def_id(body_id);
232-
let mir = cx.tcx.optimized_mir(def_id);
232+
let mir = cx.tcx.optimized_mir(def_id.to_def_id());
233233
let ret_ty = mir.return_ty();
234234
if implements_trait(cx, ret_ty, future, &[]);
235235
if let ty::Opaque(_, subs) = ret_ty.kind;

clippy_lints/src/enum_clike.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
4646
for var in def.variants {
4747
if let Some(anon_const) = &var.disr_expr {
4848
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);
49-
let mut ty = cx.tcx.type_of(def_id);
49+
let mut ty = cx.tcx.type_of(def_id.to_def_id());
5050
let constant = cx
5151
.tcx
52-
.const_eval_poly(def_id)
52+
.const_eval_poly(def_id.to_def_id())
5353
.ok()
5454
.map(|val| rustc_middle::ty::Const::from_value(cx.tcx, val, ty));
5555
if let Some(Constant::Int(val)) = constant.and_then(miri_to_const) {

clippy_lints/src/implicit_return.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitReturn {
135135
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
136136

137137
// Building MIR for `fn`s with unsatisfiable preds results in ICE.
138-
if fn_has_unsatisfiable_preds(cx, def_id) {
138+
if fn_has_unsatisfiable_preds(cx, def_id.to_def_id()) {
139139
return;
140140
}
141141

142-
let mir = cx.tcx.optimized_mir(def_id);
142+
let mir = cx.tcx.optimized_mir(def_id.to_def_id());
143143

144144
// checking return type through MIR, HIR is not able to determine inferred closure return types
145145
// make sure it's not a macro

clippy_lints/src/needless_pass_by_value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
113113

114114
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.to_vec())
115115
.filter(|p| !p.is_global())
116-
.filter_map(|pred| {
117-
if let ty::Predicate::Trait(poly_trait_ref, _) = pred {
116+
.filter_map(|obligation| {
117+
if let ty::Predicate::Trait(poly_trait_ref, _) = obligation.predicate {
118118
if poly_trait_ref.def_id() == sized_trait || poly_trait_ref.skip_binder().has_escaping_bound_vars()
119119
{
120120
return None;

clippy_lints/src/redundant_clone.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
8080
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
8181

8282
// Building MIR for `fn`s with unsatisfiable preds results in ICE.
83-
if fn_has_unsatisfiable_preds(cx, def_id) {
83+
if fn_has_unsatisfiable_preds(cx, def_id.to_def_id()) {
8484
return;
8585
}
8686

87-
let mir = cx.tcx.optimized_mir(def_id);
87+
let mir = cx.tcx.optimized_mir(def_id.to_def_id());
8888
let mir_read_only = mir.unwrap_read_only();
8989

9090
let maybe_storage_live_result = MaybeStorageLive
91-
.into_engine(cx.tcx, mir, def_id)
91+
.into_engine(cx.tcx, mir, def_id.to_def_id())
9292
.iterate_to_fixpoint()
9393
.into_results_cursor(mir);
9494
let mut possible_borrower = {

clippy_lints/src/utils/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,12 @@ pub fn fn_has_unsatisfiable_preds(cx: &LateContext<'_, '_>, did: DefId) -> bool
13891389
.iter()
13901390
.filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None })
13911391
.collect();
1392-
!traits::normalize_and_test_predicates(cx.tcx, traits::elaborate_predicates(cx.tcx, predicates).collect())
1392+
!traits::normalize_and_test_predicates(
1393+
cx.tcx,
1394+
traits::elaborate_predicates(cx.tcx, predicates)
1395+
.map(|o| o.predicate)
1396+
.collect::<Vec<_>>(),
1397+
)
13931398
}
13941399

13951400
#[cfg(test)]

0 commit comments

Comments
 (0)