diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-07-15 23:13:04 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-07-29 18:25:58 -0400 |
| commit | 25bdc8965e7a80cb3a72da79ca568953738fe433 (patch) | |
| tree | 9e5c141b84918483db882f87c8d1bbb6b3702da1 /compiler/rustc_trait_selection/src | |
| parent | 3924dac7bb29bc8eb348059c901e8f912399c857 (diff) | |
| download | rust-25bdc8965e7a80cb3a72da79ca568953738fe433.tar.gz rust-25bdc8965e7a80cb3a72da79ca568953738fe433.zip | |
Change maybe_body_owned_by to take local def id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 6c8faed0df4..b000774ed2a 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1783,8 +1783,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { let generator_body = generator_did .as_local() - .map(|def_id| hir.local_def_id_to_hir_id(def_id)) - .and_then(|hir_id| hir.maybe_body_owned_by(hir_id)) + .and_then(|local_did| hir.maybe_body_owned_by(local_did)) .map(|body_id| hir.body(body_id)); let is_async = match generator_did.as_local() { Some(_) => generator_body @@ -2752,7 +2751,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { let body_hir_id = obligation.cause.body_id; let item_id = self.tcx.hir().get_parent_node(body_hir_id); - if let Some(body_id) = self.tcx.hir().maybe_body_owned_by(item_id) { + if let Some(body_id) = + self.tcx.hir().maybe_body_owned_by(self.tcx.hir().local_def_id(item_id)) + { let body = self.tcx.hir().body(body_id); if let Some(hir::GeneratorKind::Async(_)) = body.generator_kind { let future_trait = self.tcx.require_lang_item(LangItem::Future, None); |
