-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Experiment: Reborrow traits #151753
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
Open
aapoalas
wants to merge
34
commits into
rust-lang:main
Choose a base branch
from
aapoalas:aapoalas/reborrow-and-coerce-shared-first-version
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Experiment: Reborrow traits #151753
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d6b0c00
Add basic trait resolving
aapoalas 8cb2709
Reborrow adjustment
aapoalas a6964fb
further work: reborrow now in your local MIR
aapoalas e11633b
fmt
aapoalas 819dbb7
fix: Implement proper Reborrow coercion
aapoalas a161c7b
changes
aapoalas a830c43
fmt
aapoalas 3fa1f2f
fix rebase mistake
aapoalas 989b63c
fix
aapoalas 8116826
try actually gather borrows for Rvalue::Reborrow
aapoalas 06311ec
actually nearly kind of sort of working
aapoalas a35386c
cleanup and fmt
aapoalas daa8aab
Teach borrowck that reborrow is borrowing
dingxiangfei2009 39621bd
Start CoerceShared impl
aapoalas ebae325
temp
aapoalas 66a54cf
coerce_unsized_info
aapoalas de7dee9
[PATCH] use the right region by Xiangfei Ding <dingxiangfei2009@proto…
aapoalas 14c8827
Coherence for CoerceShared probably working, actual MIR not working
aapoalas d52465d
not quite working anymore
aapoalas 27dacbc
fix CoerceShared borrow_set
aapoalas f7c4d07
make CoerceShared work
aapoalas c2411da
Make Reborrow work
aapoalas 77a6156
errors handled
aapoalas 1f968e7
Fix lifetime of reborrow by Ding Xiang Fei
aapoalas 3b1957a
Start adding more comprehensive tests
aapoalas 97994e9
fix after rebase
aapoalas 1e7b514
fix &mut -> & CoerceShared
aapoalas 37bdf23
some tests
aapoalas 2f3dde6
self-review fixes
aapoalas a6ea388
move back to marker
aapoalas 92ff599
fix and add tests
aapoalas 235d471
remove Reborrow derive for now
aapoalas 4af2661
add comments, fix Reborrow as_rvalue
aapoalas 41f7cf5
add one test
aapoalas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This being requires is another sign that this may not be the best representation.
From other use sites it seems to me like you'd want to generalize Rvalue::Ref to support more types than references
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.
Answered above as well, but we thought that generalising
Rvalue::Refwould be a very big, even massive change that would be very hard to walk back from, and might also have a measurable negative performance impact on the compiler.Rvalue::Refseems like it might also be somewhat tightly (and understandably) bound to being produced by the&_operation, which would then no longer be the case for generalised reborrowable types. eg. simplifying&*_to_would not be possible by simply checking forRvalue::Refand aDerefprojection, as theRvalue::Refthere could actually be a generalised reborrow operation.That being said... I definitely do see the appeal; it'd be nice if the compiler could view
&mut Tandstruct CustomMut<T>(*mut T, PhantomData<&T>)exactly equivalently.