diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-02-01 12:29:22 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-02-01 12:29:22 +0100 |
| commit | 3e01b0a8fd9325928a1df10ee1c5210dacc5a859 (patch) | |
| tree | 1bf7a36632c2080c7580fb905de8d942b3f206e8 | |
| parent | a00e130dae74a213338e2b095ec855156d8f3d8a (diff) | |
Fix lifetime elision in type aliases
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 33612c80654..6a654eebaa2 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1426,15 +1426,25 @@ fn normalize<'tcx>(cx: &mut DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> { return None; } + use crate::rustc_trait_selection::infer::TyCtxtInferExt; + use crate::rustc_trait_selection::traits::query::normalize::AtExt; + use rustc_middle::traits::ObligationCause; + // Try to normalize `<X as Y>::T` to a type let lifted = ty.lift_to_tcx(cx.tcx).unwrap(); - match cx.tcx.try_normalize_erasing_regions(cx.param_env, lifted) { + let normalized = cx.tcx.infer_ctxt().enter(|infcx| { + infcx + .at(&ObligationCause::dummy(), cx.param_env) + .normalize(lifted) + .map(|resolved| infcx.resolve_vars_if_possible(resolved.value)) + }); + match normalized { Ok(normalized_value) => { - trace!("normalized {:?} to {:?}", ty, normalized_value); + debug!("normalized {:?} to {:?}", ty, normalized_value); Some(normalized_value) } Err(err) => { - info!("failed to normalize {:?}: {:?}", ty, err); + debug!("failed to normalize {:?}: {:?}", ty, err); None } } |
