-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
should be possible to do [CopyableVariant, ..n] for a non-copyable type #5244
Comments
Does this suffice as a test case? struct Foo;
impl Drop for Foo { fn finalize(&self) {} }
fn main() {
let y = Foo;
let x = [y, ..10];
} I'm not sure what you mean by that |
which I believe will fail to compile. |
This is still an annoying issue. :) |
It seems to me that the more general solution is coming up with some way to say |
At some point, we discussed applying a similar test to the one that we |
I submitted PR #14272 which adds |
cc me |
closing in favor of rust-lang/rfcs#832, which is going to end up doing this. |
That RFC only provides the functionality in the vec macro through Clone. This still wouldn't allow a |
Ah, I mis-read: I thought that it was supporting non-Clone too. |
Moving to the RFC repo generally rust-lang/rfcs#1366 |
This should be fixable by special casing this (the type isn't copyable, but for this specific case the variant is).
This problem only exists with fixed-size vectors since
vec::from_fn(10, |_| None)
works with non-copyable types.@nikomatsakis thinks this should be fixable
The text was updated successfully, but these errors were encountered: