-
Notifications
You must be signed in to change notification settings - Fork 357
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
Optional semantics for Unique
#2936
Conversation
did some discussions related to this happen somewhere? I'm not against this change, just curious since it came out of nowhere from my perspective :D |
No, this is an experiment Neven and me discussed.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, just some nits :)
//@compile-flags: -Zmiri-tree-borrows | ||
//@[uniq]compile-flags: -Zmiri-unique-is-unique |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing here actually uses unique, or does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are Vec
s and Box
es in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we get any test breakage if libs decides to remove ptr::Unique
from Vec
? Or would that be just okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will get test breakage but that seems fine for me, we can then just adjust the tests.
Rebased at README: -Zmiri-unique-is-unique Tests will fail. |
If you rebase over latest Miri master (and run |
The problem here is that ProblemThe following diff illustrates the issue: --- tests/pass/tree_borrows/unique.uniq.stderr
| Act| └─┬──<TAG=base>
| Act| └─┬──<TAG=raw>
-| Act| └────<TAG=uniq, uniq>
+|?Dis| ├────<TAG=uniq>
+|?Dis| └────<TAG=uniq>
This part of the diff shows that the wrong pointer is being named, since it gets invalidated when the pointer inside -| Act|
+|?Dis| This part of the diff shows that pointers obtained from - └────<TAG=uniq, uniq>
+ ├────<TAG=uniq>
+ └────<TAG=uniq> SolutionIn the long term, if we find out that Right now, this illustrates that |
Isn't this a bigger problem than just the ui tests? This means we cannot do the equivalent of I guess if the tests still pass we can keep going with the experiment, but eventually we might want a new borrow state for this, one where alias requirements are only enforced while the tag is protected. |
Yes this would make |
FWIW github doesn't send notification for this so it's pretty much useless. Thankfully we have a bot that helps: @rustbot ready. :) |
//@compile-flags: -Zmiri-tree-borrows | ||
//@[uniq]compile-flags: -Zmiri-unique-is-unique |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will get test breakage but that seems fine for me, we can then just adjust the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tweaks for the comments -- please apply the same changes to all copies of these comments.
Then please squash the commits and we can land this. :)
@bors r+ |
☀️ Test successful - checks-actions |
Use with
-Zmiri-unique-is-unique
, makescore::ptr::Unique
get a reborrow with its own permissions.