-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
fix a few errant Krate
edges
#35960
fix a few errant Krate
edges
#35960
Conversation
|
||
/// Tracks nodes that are forbidden to read/write; see | ||
/// `DepGraph::forbid`. Used for debugging only. | ||
forbidden: RefCell<Vec<DepNode<DefId>>>, |
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.
Should this field also be #[cfg(debug_assertions)]-ed?
Good catches both! |
I remember a similar place in coherence where I intentionally held the lock because someone (i.e., metadata loading) was inserting stuff to the list behind my back and I wanted to prevent that problem from recurring. If nobody is supposed to mutate a list behind your back, holding a lock is the "safe" option - it can lead to more ICEs, but it can make your assumptions more visible. |
☔ The latest upstream changes (presumably #36030) made this pull request unmergeable. Please resolve the merge conflicts. |
e08d4fb
to
30c6f12
Compare
@bors r=mw |
📌 Commit 30c6f12 has been approved by |
@bors r- |
Warnings from travis look legit, even though I didn't see anything like that locally. Maybe I didn't run full tests on the latest commit or something. |
30c6f12
to
386abe1
Compare
@bors r=mw |
📌 Commit d287b7a has been approved by |
@bors r- // again the travis issue looks legit, and again I wonder why I am not seeing this locally! |
d287b7a
to
3b4e587
Compare
The answer is sort of yes, but I wound up (see most recent commit) taking a different approach. In particular, the number of things that must have I'm not sure what's a better way to formulate the code here. It occurs to me now I could maybe make a |
Oh, I am dumb, it's because I'm building with debug-assertions enabled, of course! |
OK, so, I wound up implementing a better mechanism altogether. I'll push a few more commits shortly. |
54f8bdf
to
cf7fd6b
Compare
r? @michaelwoerister -- this fixes one add'l bug, and revamps the forbidden stuff into something more powerful. |
2d893b3
to
bf27870
Compare
☔ The latest upstream changes (presumably #36203) made this pull request unmergeable. Please resolve the merge conflicts. |
The goal here is to avoid writing to the `inherent_impls` map from within the general `Coherence` task, and instead write to it as we visit. Writing to it from the Coherence task is actually an information leak; it happened to be safe because Coherence read from `DepNode::Krate`, but that was very coarse. I removed the `Rc` here because, upon manual inspection, nobody clones the data in this table, and it meant that we can accumulate the data in place. That said, the pattern that is used for the inherent impls map is *generally* an anti-pattern (that is, holding the borrow lock for the duration of using the contents), so it'd probably be better to clone (and I doubt that would be expensive -- how many inherent impls does a typical type have?).
We touch the krate to adjust the maps, but we don't expose that data widely.
It is useful to track down an errant edge that is being added. This is not a perfect mechanism, since it doesn't consider (e.g.) if we are in an ignored task, but it's helpful enough for now.
It was duplicating information available elsewhere.
The shadow graph supercedes the existing code that checked for reads/writes without an active task and now adds the ability to filter for specific edges.
Across crates only, converting a def-id into its def-key or def-path was considered a read. This caused spurious reads when computing the symbol name for some item.
supplanted by RUST_FORBID_DEP_GRAPH_EDGE
I also added an `opt_def_path` so that we can deal with DefIds that are missing a `DefPath` entry.
add licenses to shadow.rs
bf27870
to
c2ffa2f
Compare
|
||
That first edge looks suspicious to you. So you set | ||
`RUST_FORBID_DEP_GRAPH_EDGE` to `Hir&foo -> Collect&bar`, re-run, and | ||
then observe the backtrace. Voila, bug fixed! |
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.
Nice! :)
@bors r+ |
📌 Commit 9ca5786 has been approved by |
…oerister fix a few errant `Krate` edges Exploring the effect of small changes on `syntex` reuse, I discovered the following sources of unnecessary edges from `Krate` r? @michaelwoerister
Exploring the effect of small changes on
syntex
reuse, I discovered the following sources of unnecessary edges fromKrate
r? @michaelwoerister