Change const trait bound syntax from ~const to [const]

This commit is contained in:
Oli Scherer
2025-03-11 12:08:45 +00:00
parent 18f4cb1110
commit eb7245a864
234 changed files with 1382 additions and 1319 deletions

View File

@@ -344,7 +344,7 @@ fn check_opaque_meets_bounds<'tcx>(
let misc_cause = ObligationCause::misc(span, def_id);
// FIXME: We should just register the item bounds here, rather than equating.
// FIXME(const_trait_impl): When we do that, please make sure to also register
// the `~const` bounds.
// the `[const]` bounds.
match ocx.eq(&misc_cause, param_env, opaque_ty, hidden_ty) {
Ok(()) => {}
Err(ty_err) => {

View File

@@ -264,9 +264,9 @@ fn compare_method_predicate_entailment<'tcx>(
}
// If we're within a const implementation, we need to make sure that the method
// does not assume stronger `~const` bounds than the trait definition.
// does not assume stronger `[const]` bounds than the trait definition.
//
// This registers the `~const` bounds of the impl method, which we will prove
// This registers the `[const]` bounds of the impl method, which we will prove
// using the hybrid param-env that we earlier augmented with the const conditions
// from the impl header and trait method declaration.
if is_conditionally_const {
@@ -2335,7 +2335,7 @@ pub(super) fn check_type_bounds<'tcx>(
)
.collect();
// Only in a const implementation do we need to check that the `~const` item bounds hold.
// Only in a const implementation do we need to check that the `[const]` item bounds hold.
if tcx.is_conditionally_const(impl_ty_def_id) {
obligations.extend(util::elaborate(
tcx,

View File

@@ -1399,7 +1399,7 @@ fn check_impl<'tcx>(
}
}
// Ensure that the `~const` where clauses of the trait hold for the impl.
// Ensure that the `[const]` where clauses of the trait hold for the impl.
if tcx.is_conditionally_const(item.owner_id.def_id) {
for (bound, _) in
tcx.const_conditions(trait_ref.def_id).instantiate(tcx, trait_ref.args)