Skip to content

Commit 786f88a

Browse files
committed
Address some review comments
1 parent 7611ded commit 786f88a

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter, RegionInferReason};
2323
/// inferred constraints concerning which regions outlive other regions.
2424
#[instrument(level = "debug", skip(tcx))]
2525
pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
26-
// Anon const as RHS of const item is the body, so should have the same predicates.
27-
// FIXME(mgca): probably should have only the predicates of params that are explicitly referenced,
28-
// as should generics_of (maybe only under mgca?)
29-
if matches!(tcx.def_kind(def_id), DefKind::AnonConst)
30-
&& let parent = tcx.parent(def_id)
31-
&& matches!(tcx.def_kind(parent), DefKind::Const | DefKind::AssocConst)
32-
{
33-
return tcx.predicates_of(parent);
34-
}
35-
3626
let mut result = tcx.explicit_predicates_of(def_id);
3727
debug!("predicates_of: explicit_predicates_of({:?}) = {:?}", def_id, result);
3828

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ fn const_arg_anon_type_of<'tcx>(icx: &ItemCtxt<'tcx>, arg_hir_id: HirId, span: S
103103
icx.lower_ty(ty)
104104
}
105105

106-
Node::Item(hir::Item { kind: hir::ItemKind::Const(_, ty, ..), .. })
107-
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, ..), .. })
108-
| Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Const(ty, ..), .. }) => {
109-
icx.lower_ty(ty)
110-
}
106+
Node::Item(hir::Item { kind: hir::ItemKind::Const(..), owner_id, .. })
107+
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(..), owner_id, .. })
108+
| Node::TraitItem(hir::TraitItem {
109+
kind: hir::TraitItemKind::Const(..), owner_id, ..
110+
}) => tcx.type_of(owner_id.def_id).instantiate_identity(),
111111

112112
// This is not a `bug!` as const arguments in path segments that did not resolve to anything
113113
// will result in `type_of` never being fed.

0 commit comments

Comments
 (0)