rust-lang/rust

Tracking issue for RFC 2632 `?const` trait bound opt-out

ecstatic-morse opened this issue · 7 comments

This is the tracking issue for the ?const opt-out for trait bounds described in rust-lang/rfcs#2632. The primary tracking issue for that RFC is #67792. The feature gate for it is const_trait_bound_opt_out.

This RFC has not yet been accepted. It is being implemented on a provisional basis to evaluate the potential fallout.

cc #57563

Implementation steps:

  • Implement (#68140)
  • Forbid ?const outside const fn or impl const Trait

From what I understand, this was recently changed to ~const but none of the tilde-const PRs link back to this one, and the issue name/description should be updated?

cc @oli-obk @fee1-dead since from what I understand you two know the most about this change

The opt-out is no longer needed. The previous scheme was:

const fn a<T: /* inferred const bound */ Foo + /* opt-out normal trait bound */ ?const Bar>

And the current scheme is now:

const fn a<T: /* normal trait bound */ Foo + /* const bound if called in a const context */ ~const Bar>

This issue should be closed, but it can be reopened if somehow we decide to use ?const opt-out again.

So where is ~const tracked then? #67792?

yea, const_trait_impl requires the opt in syntax, otherwise you can't write anything but trivial impls

So... is there no dedicated tracking issue for ~const, then?

Mostly because I don't see any easy place someone can look to know what the new syntax means.

I updated the const_trait_impl tracking issue to link to the latest RFC text