Skip to content

Commit ed3966f

Browse files
authored
Merge pull request #1485 from Nadrieril/fix-constants
Fix detection of trait associated constants
2 parents a0bcff0 + 3cf4a67 commit ed3966f

File tree

1 file changed

+2
-2
lines changed
  • frontend/exporter/src/constant_utils

1 file changed

+2
-2
lines changed

frontend/exporter/src/constant_utils/uneval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ pub fn translate_constant_reference<'tcx>(
111111
.try_normalize_erasing_regions(typing_env, ty)
112112
.unwrap_or(ty);
113113
let kind = if let Some(assoc) = s.base().tcx.opt_associated_item(ucv.def) {
114-
if assoc.trait_item_def_id.is_some() {
115-
// This must be a trait declaration constant
114+
if assoc.trait_item_def_id.is_some() || assoc.container == ty::AssocItemContainer::Trait {
115+
// This is an associated constant in a trait.
116116
let name = assoc.name.to_string();
117117
let impl_expr = self_clause_for_item(s, ucv.def, ucv.args).unwrap();
118118
ConstantExprKind::TraitConst { impl_expr, name }

0 commit comments

Comments
 (0)