-
Notifications
You must be signed in to change notification settings - Fork 220
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
analyze: omit unused hypothetical lifetimes during rewriting #1015
Conversation
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.
For 5a88caa, were you seeing known ptr permissions change? Which ones?
@spernsteiner are we somehow constraining things, resulting in a different set of rewrites, by giving hypothetical lifetimes to polonius that won't end up being used? |
This apparently also fixes #994 |
For variables that get rewritten to If this does turn out to be an issue, we can think about borrowck improvements then (and having a real example to look at will help). |
…rameters introduced
49c2e68
to
9267e55
Compare
This change removes hypothetical lifetimes for pointers that are rewritten into non-ref types, such as raw pointers or
Box<T>
. TheAdtMetadataTable
is computed normally at first so it can be used in borrowck, but once all pointer permissions have been determined, it's recomputed with an extra filter that skips creating hypothetical region params for pointers whosetype_desc::Ownership
is notImm
,Cell
, orMut
(&T
,&Cell<T>
, or&mut T
).For example:
Previously,
Foo
would be rewritten to have two new region parameters, one forp
and one forq
. But the region forq
would unused:q
is markedFIXED
, so it's left as*mut u8
rather than rewritten to a safe reference type. With this change,Foo
is rewritten to have only one region parameter, the one forp
. This avoids rustc errors about unused generic parameters in the rewritten code.