const fn f<T>(_: Box<T>) {}
(playground)
Note that this works even if T implements Drop in a non-const way. This seems hightly problematic, especially provided we eventually want to support constructing Box at compile time.
Relevant PR: #91884
Of course that impl claims to be unstable, but as we all know trait implementations are never unstable, unless the trait is unstable. (For ordinary traits, implementations of const Trait are thus unstable merely due to the fact that no user can use any such implementations in stable code yet.)
@rustbot label regression-from-stable-to-stable
I don’t know what team to tag.
The fix should be straightforward: Remove the const Drop for Box<T, A> implementation (i.e. revert it to be non-const), and add a test.
(playground)
Note that this works even if
TimplementsDropin a non-constway. This seems hightly problematic, especially provided we eventually want to support constructingBoxat compile time.Relevant PR: #91884
Of course that impl claims to be unstable, but as we all know trait implementations are never unstable, unless the trait is unstable. (For ordinary traits, implementations of
const Traitare thus unstable merely due to the fact that no user can use any such implementations in stable code yet.)@rustbot label regression-from-stable-to-stable
I don’t know what team to tag.The fix should be straightforward: Remove the
const Drop for Box<T, A>implementation (i.e. revert it to be non-const), and add a test.