@@ -1519,6 +1519,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
1519
1519
param_def_id_to_index,
1520
1520
has_self: generics.has_self,
1521
1521
has_constness: generics.has_constness,
1522
+ parent_has_constness: generics.parent_has_constness,
1522
1523
has_late_bound_regions: generics.has_late_bound_regions,
1523
1524
};
1524
1525
}
@@ -1624,9 +1625,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
1624
1625
};
1625
1626
1626
1627
let has_self = opt_self.is_some();
1627
- let has_constness = tcx.has_attr(def_id, sym::const_trait)
1628
- || (tcx.def_kind(def_id) == DefKind::Impl
1629
- && tcx.impl_constness(def_id) == hir::Constness::Const);
1628
+ let has_constness = tcx.should_have_constness(def_id);
1630
1629
let mut parent_has_self = false;
1631
1630
let mut parent_has_constness = false;
1632
1631
let mut own_start = has_self as u32;
@@ -1783,6 +1782,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
1783
1782
param_def_id_to_index,
1784
1783
has_self: has_self || parent_has_self,
1785
1784
has_constness: has_constness || parent_has_constness,
1785
+ parent_has_constness: parent_has_constness,
1786
1786
has_late_bound_regions: has_late_bound_regions(tcx, node),
1787
1787
};
1788
1788
trace!("{:#?}", generics);
0 commit comments