Be better at enforcing that const_conditions is only called on const items

This commit is contained in:
Michael Goulet
2024-10-23 16:53:59 +00:00
parent 25c9253379
commit 0f5a47d088
12 changed files with 126 additions and 120 deletions

View File

@@ -89,7 +89,11 @@ impl<'tcx> Bounds<'tcx> {
host: ty::HostPolarity,
span: Span,
) {
self.clauses.push((bound_trait_ref.to_host_effect_clause(tcx, host), span));
if tcx.is_const_trait(bound_trait_ref.def_id()) {
self.clauses.push((bound_trait_ref.to_host_effect_clause(tcx, host), span));
} else {
tcx.dcx().span_delayed_bug(span, "tried to lower {host:?} bound for non-const trait");
}
}
pub(crate) fn clauses(