Skip to content

Commit d322846

Browse files
committed
Implement type_of for anon consts on RHS of const items
1 parent a38bbde commit d322846

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ 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+
}
111+
106112
// This is not a `bug!` as const arguments in path segments that did not resolve to anything
107113
// will result in `type_of` never being fed.
108114
_ => Ty::new_error_with_message(

0 commit comments

Comments
 (0)