make precise capturing args in rustdoc Json typed
This commit is contained in:
parent
cdd8af2299
commit
112f7b01a1
11 changed files with 96 additions and 20 deletions
|
@ -28,7 +28,7 @@ use rustc_errors::{
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt, walk_generics};
|
||||
use rustc_hir::{self as hir, GenericParamKind, HirId, Node};
|
||||
use rustc_hir::{self as hir, GenericParamKind, HirId, Node, PreciseCapturingArgKind};
|
||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
|
@ -1792,7 +1792,7 @@ fn opaque_ty_origin<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> hir::OpaqueT
|
|||
fn rendered_precise_capturing_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
) -> Option<&'tcx [Symbol]> {
|
||||
) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
|
||||
if let Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) =
|
||||
tcx.opt_rpitit_info(def_id.to_def_id())
|
||||
{
|
||||
|
@ -1801,7 +1801,12 @@ fn rendered_precise_capturing_args<'tcx>(
|
|||
|
||||
tcx.hir_node_by_def_id(def_id).expect_opaque_ty().bounds.iter().find_map(|bound| match bound {
|
||||
hir::GenericBound::Use(args, ..) => {
|
||||
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| arg.name())))
|
||||
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| match arg {
|
||||
PreciseCapturingArgKind::Lifetime(_) => {
|
||||
PreciseCapturingArgKind::Lifetime(arg.name())
|
||||
}
|
||||
PreciseCapturingArgKind::Param(_) => PreciseCapturingArgKind::Param(arg.name()),
|
||||
})))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue