diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-07-19 17:06:52 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-07-29 18:26:10 -0400 |
| commit | 16513d689e4fe30e58a37dd773af5be9210ebcbd (patch) | |
| tree | 3b4375ba578709ef3142542c85d2ef411987ddea /compiler/rustc_ty_utils | |
| parent | 25bdc8965e7a80cb3a72da79ca568953738fe433 (diff) | |
| download | rust-16513d689e4fe30e58a37dd773af5be9210ebcbd.tar.gz rust-16513d689e4fe30e58a37dd773af5be9210ebcbd.zip | |
Rename local_did to def_id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_ty_utils')
| -rw-r--r-- | compiler/rustc_ty_utils/src/ty.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index f437eb98942..b1af3051719 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -207,10 +207,14 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { constness, ); - let body_id = local_did - .and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id)) - .or(hir_id) - .map_or(hir::CRATE_HIR_ID, |did| did); + let body_id = + local_did.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id)); + let body_id = match body_id { + Some(id) => id, + None if hir_id.is_some() => hir_id.unwrap(), + _ => hir::CRATE_HIR_ID, + }; + let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id); traits::normalize_param_env_or_error(tcx, unnormalized_env, cause) } |
