-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
~const bounds do not work when impling const Drop #92881
Comments
workaround: play #![feature(const_trait_impl, const_fn_trait_bound, const_mut_refs)]
trait X {
fn x();
}
struct Y<T: X>(T);
impl<T: X> const Drop for Y<T> {
fn drop(&mut self)
where
T: ~const X
{
T::x();
}
} |
Might be enough to just replace |
cc @fee1-dead |
This workaround causes the type to impl
This isn't enough. The constness of the bound seems to not get checked at all. |
I'm not exactly sure how trait selection works, but I think the problem may be here, where only the constness of the impl is checked, and not any of the bounds. |
@drmeepster you wouldn't believe that the same exact line was on my clipboard, and I was going to say that it was somewhere around Yeah, it seems like we need to enforce that the |
Perhaps need to add some real confirmation logic here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/select/confirmation.rs#L162 |
I'll take a stab at this, if nobody else is planning on it already! cc @fee1-dead: |
I encountered this issue while trying to remove
box_free
.I tried this code:
I expected the code to compile.
Instead, I got the following error:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: