Fix review comments
This commit is contained in:
parent
37f20b7631
commit
80bd069138
2 changed files with 5 additions and 11 deletions
|
|
@ -1283,6 +1283,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
)
|
||||
});
|
||||
|
||||
// FIXME(mgca): code duplication with other places we lower
|
||||
// the rhs' of associated const bindings
|
||||
let ty = projection_term.map_bound(|alias| {
|
||||
tcx.type_of(alias.def_id).instantiate(tcx, alias.args)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -471,19 +471,13 @@ fn clean_middle_term<'tcx>(
|
|||
fn clean_hir_term<'tcx>(
|
||||
assoc_item: Option<DefId>,
|
||||
term: &hir::Term<'tcx>,
|
||||
span: rustc_span::Span,
|
||||
cx: &mut DocContext<'tcx>,
|
||||
) -> Term {
|
||||
match term {
|
||||
hir::Term::Ty(ty) => Term::Type(clean_ty(ty, cx)),
|
||||
hir::Term::Const(c) => {
|
||||
let ty = if let Some(assoc_item) = assoc_item {
|
||||
// FIXME(generic_const_items): this should instantiate with the alias item's args
|
||||
cx.tcx.type_of(assoc_item).instantiate_identity()
|
||||
} else {
|
||||
Ty::new_error_with_message(cx.tcx, span, "cannot find the associated constant")
|
||||
};
|
||||
|
||||
// FIXME(generic_const_items): this should instantiate with the alias item's args
|
||||
let ty = cx.tcx.type_of(assoc_item.unwrap()).instantiate_identity();
|
||||
let ct = lower_const_arg_for_rustdoc(cx.tcx, c, ty);
|
||||
Term::Constant(clean_middle_const(ty::Binder::dummy(ct), cx))
|
||||
}
|
||||
|
|
@ -3170,9 +3164,7 @@ fn clean_assoc_item_constraint<'tcx>(
|
|||
.associated_items(trait_did)
|
||||
.find_by_ident_and_kind(cx.tcx, constraint.ident, assoc_tag, trait_did)
|
||||
.map(|item| item.def_id);
|
||||
AssocItemConstraintKind::Equality {
|
||||
term: clean_hir_term(assoc_item, term, constraint.span, cx),
|
||||
}
|
||||
AssocItemConstraintKind::Equality { term: clean_hir_term(assoc_item, term, cx) }
|
||||
}
|
||||
hir::AssocItemConstraintKind::Bound { bounds } => AssocItemConstraintKind::Bound {
|
||||
bounds: bounds.iter().filter_map(|b| clean_generic_bound(b, cx)).collect(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue