-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Path fragments for drop obligations #18234
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
Path fragments for drop obligations #18234
Conversation
ping @pnkfelix |
@alexcrichton was that an implied request for me to rebase my PR based on @nikomatsakis 's feedback so far? I note that it seems like he is going through the commits (rather than the diff), so I would assume it might be better for me to wait until he is done with the initial review ... |
@alexcrichton (oh, in case its not clear, @nikomatsakis has already noted to me in several priv msg's that he is intending to return to this review...) |
@pnkfelix indeed I am doing that RIGHT NOW! |
ok, r+ modulo the handling of |
This is really nice, well documented. |
ah sorry didn't mean to annoy, just making sure the queue is moving! |
afc70f3
to
52ef4e4
Compare
52ef4e4
to
de78321
Compare
`LpDowncast` carries the `DefId` of the variant itself. To support this, added the enum variant `DefId` to the `cat_downcast` variant in `mem_categorization::categorization`. (updated to fix mem_categorization to handle downcast of enum struct-variants properly.)
To make this clean, refactored old `LoanPath` enum into a `LoanPath` struct with a `ty::t` and a newly-added `LoanPathVariant` enum. This enabled me to get rid of the ugly and fragile `LoanPath::to_type` method, and I can probably also get rid of other stuff that was supporting it, maybe.
… val now. This is to fix a problem where I could not reliably map attach the type for each loan-path to the loan-path itself because the same loan-path was ending up associated with two different types, because the cmt's had diverged in their interpretation of the path.
This is accomplished by: 1. Add `MatchMode` enum to `expr_use_visitor`. 2. Computing the match mode for each pattern via a pre-pass, and then passing the mode along when visiting the pattern in expr_use_visitor. 3. Adding a `fn matched_pat` callback to expr_use_visitor, which is called on interior struct and enum nodes of the pattern (as opposed to `fn consume_pat`, which is only invoked for identifiers at the leaves of the pattern), and invoking it accordingly. Of particular interest are the `cat_downcast` instances established when matching enum variants.
Includes differentiation between assigned_fragments and moved_fragments, support for all-but-one array fragments, and instrumentation to print out the moved/assigned/unmmoved/parents for each function, factored out into separate submodule.
The tests use new "//~| ERROR" follow syntax. Includes a test for moves involving array elements. It was easier than i realized to get something naive off the ground here.
de78321
to
5fbe0ca
Compare
…-2, r=nikomatsakis Code to fragment paths into pieces based on subparts being moved around, e.g. moving `x.1` out of a tuple `(A,B,C)` leaves behind the fragments `x.0: A` and `x.2: C`. Further discussion in borrowck/doc.rs. Includes differentiation between assigned_fragments and moved_fragments, support for all-but-one array fragments, and instrumentation to print out the moved/assigned/unmmoved/parents for each function, factored out into a separate submodule. These fragments can then be used by `trans` to inject stack-local dynamic drop flags. (They also can be hooked up with dataflow to reduce the expected number of injected flags.)
…Veykril internal: Filter out opaque tokens in some IDE feature macro descensions
Code to fragment paths into pieces based on subparts being moved around, e.g. moving
x.1
out of a tuple(A,B,C)
leaves behind the fragmentsx.0: A
andx.2: C
. Further discussion in borrowck/doc.rs.Includes differentiation between assigned_fragments and moved_fragments, support for all-but-one array fragments, and instrumentation to print out the moved/assigned/unmmoved/parents for each function, factored out into a separate submodule.
These fragments can then be used by
trans
to inject stack-local dynamic drop flags. (They also can be hooked up with dataflow to reduce the expected number of injected flags.)