-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Audit metadata dep-graph edges #35111
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
Comments
So, if we used rust/src/librustc_metadata/encoder.rs Line 1417 in 5a7773a
|
@michaelwoerister yeah, actually, I think that was a mistake on my part. That would certainly be a good step. :) Probably ought to change the names there to make the distinction more obvious. |
I'll tackle this. |
It would also be good to see if we are reading data from external crates that is not linked to a specific |
Restructure metadata encoder to track deps precisely This issue restructures meta-data encoding to track dependencies very precisely. It uses a cute technique I hope to spread elsewhere, where we can guard the data flowing into a new dep-graph task and ensure that it is not "leaking" information from the outside, which would result in missing edges. There are no tests because we don't know of any bugs in the old system, but it's clear that there was leaked data. The commit series is standalone, but the refactorings are kind of "windy". It's a good idea to read the comment in `src/librustc_metadata/index_builder.rs` to get a feeling for the overall strategy I was aiming at. In several cases, I wound up adding some extra hashtable lookups, I think primarily for looking up `AdtDef` instances. We could remove these by implementing `DepGraphRead` for an `AdtDef` and then having it register a read to the adt-defs table, I guess, but I doubt it is really noticeable. Eventually I think I'd like to extend this pattern to the dep-graph more generally, since it effectively guarantees that data cannot leak. Fixes #35111. r? @michaelwoerister
When we record the metadata, we create a new task for the metadata pertaining to each item. The incoming edges to this task are then used to compute the hash of the metadata. This is all good, but there are a number of cases of "information leaks" that will lead to missing edges.
One example:
Here, if the function reads from
m
orimpl_item_opt
, this will not result in any incoming edges to the taskX
. To make this correct, we should either add artificial, explicit reads to account for those parameters or -- probably better -- minimize the data we pass in, and haveencode_info_for_method
go fetch things out of the appropriate maps, which will register the proper reads.The text was updated successfully, but these errors were encountered: