X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Ffor_loops_over_fallibles.rs;h=1add352e0c42d853f719a2db62c234b5497864ef;hb=1dbb5efff35b98f8e11dab87d0a98136e6cf9390;hp=5219992ee94f0a76e4590bb0bebbe5508c029140;hpb=68b390ae2a099a598bfe44d4ec36ae15159c283f;p=rust.git diff --git a/compiler/rustc_lint/src/for_loops_over_fallibles.rs b/compiler/rustc_lint/src/for_loops_over_fallibles.rs index 5219992ee94..1add352e0c4 100644 --- a/compiler/rustc_lint/src/for_loops_over_fallibles.rs +++ b/compiler/rustc_lint/src/for_loops_over_fallibles.rs @@ -139,9 +139,10 @@ fn suggest_question_mark<'tcx>( let ty = substs.type_at(0); let infcx = cx.tcx.infer_ctxt().build(); + let body_def_id = cx.tcx.hir().body_owner_def_id(body_id); let cause = ObligationCause::new( span, - body_id.hir_id, + body_def_id, rustc_infer::traits::ObligationCauseCode::MiscObligation, ); let errors = rustc_trait_selection::traits::fully_solve_bound(