-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Overloaded operators can copy self when self is noncopyable. #2548
Comments
This small variant has the correct behavior.
|
This happens because trans does not know to move in |
I just landed the "move vector-append out of trans" code, so this should be mostly fixed. Unfortunately, there's a bug in checking self types that means it's still not too hard to copy an uncopyable. |
Are there 2 instances being created?
Output:
|
Yeah, that's the problem with this issue. Classes with a destructor are supposed to be non-copyable, but this shows how to trick the type system into copying one for you. |
I don't understand, what leads to the copy of self? @eholk can you update the title and maybe add a comment on what precisely is still wrong? |
@nikomatsakis I'll add an updated test case on this. After thinking about it for a bit, I think this might be a dup of #2587. |
Hmm, that test case should actually be a compile-fail test (unless + took ownership of self), since |
Should be fixed as of 46990ad |
…r=RalfJung avoid thread-local var indirection for non-halting diagnostics This hack used to be necessary because Stacked Borrows did not have access to enough parts of the machine. But that got fixed a while ago, so now we can just emit diagnostics directly, which is a lot more reliable. Needs rust-lang#101985 Fixes rust-lang/miri#2538
This outputs
Goodbye, World!
twice, when it should only do it once.The text was updated successfully, but these errors were encountered: