Uh oh!
There was an error while loading. Please reload this page.
Better debug logs for borrowck constraint graph - #104239
Conversation
rustbot
commented
Nov 10, 2022
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Noratrieb
commented
Nov 10, 2022
This adds a huge amount of fnwith_reg_var_to_origin(&self,f:implFnOnce(RefCell<FxHashMap<ty::RegionVid,RegionCtxt>>))that calls the closure when |
b-naber
commented
Nov 10, 2022
Something like this would have the downside of passing in unused arguments (the |
bors
commented
Nov 11, 2022
☔ The latest upstream changes (presumably #104293) made this pull request unmergeable. Please resolve the merge conflicts. |
jackh726
commented
Dec 1, 2022
Can we try to add this without all the |
b-naber
commented
Dec 14, 2022
@jackh726 Sorry, didn't immediately have time when I saw your reply and then forgot that you posted. |
bors
commented
Dec 23, 2022
☔ The latest upstream changes (presumably #105036) made this pull request unmergeable. Please resolve the merge conflicts. |
jackh726
commented
Dec 26, 2022
Agh sorry for the delay. Can you rebase and remove the cargo.lock changes? |
8dc0366 to
570ad62Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
jackh726
commented
Jan 18, 2023
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
jackh726
commented
Jan 18, 2023
Agh |
jackh726
commented
Jan 18, 2023
@bors try |
jackh726
commented
Feb 20, 2023
Okay good. Can we do one more with the cfgs removed? |
0e917b4 to
c9843d6Compareb-naber
commented
Feb 20, 2023
Forgot that I also should be able to request a perf run, let's see: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Feb 20, 2023
⌛ Trying commit c9843d6 with merge e02ff57926ffbe7e5ed3694d530b665c6917be1d... |
bors
commented
Feb 21, 2023
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Feb 21, 2023
Finished benchmarking commit (e02ff57926ffbe7e5ed3694d530b665c6917be1d): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
jackh726
commented
Feb 21, 2023
Okay, unless there's anything else you think you want to try, I think we land this as-is. How's that sound @b-naber? |
b-naber
commented
Feb 21, 2023
@jackh726 Don't have anything else to try. |
jackh726
left a comment
There was a problem hiding this comment.
Just a couple nits. r=me with or without them
| scc_indices: IndexVec<N, S>, | ||
| pub scc_indices: IndexVec<N, S>, | ||
| /// Data about each SCC. | ||
| scc_data: SccData<S>, | ||
| pub scc_data: SccData<S>, | ||
| } | ||
| struct SccData<S: Idx> { | ||
| pub struct SccData<S: Idx> { | ||
| /// For each SCC, the range of `all_successors` where its | ||
| /// successors can be found. | ||
| ranges: IndexVec<S, Range<usize>>, | ||
| pub ranges: IndexVec<S, Range<usize>>, | ||
| /// Contains the successors for all the Sccs, concatenated. The | ||
| /// range of indices corresponding to a given SCC is found in its | ||
| /// SccData. | ||
| all_successors: Vec<S>, | ||
| pub all_successors: Vec<S>, |
There was a problem hiding this comment.
I kind of think these should stay private, with public functions that return immutable access?
| pub fn is_var(self) -> bool { | ||
| matches!(self.kind(), ty::ReVar(_)) | ||
| } | ||
| pub fn try_get_var(self) -> Option<RegionVid> { | ||
| match self.kind() { | ||
| ty::ReVar(vid) => Some(vid), | ||
| _ => None, | ||
| } | ||
| } |
There was a problem hiding this comment.
just a nit, but I kind of like as_var or just var more.
Also, in theory, is_var is redundant now, because you can just do l.as_var().is_some()
| infcx.tcx.fold_regions(value, |_region, _depth| { | ||
| let origin = NllRegionVariableOrigin::Existential { from_forall: false }; | ||
| infcx.next_nll_region_var(origin) | ||
| infcx.next_nll_region_var(origin, || get_ctxt_fn()) |
There was a problem hiding this comment.
No, get_ctxt_fn is captured in fold_regions which is FnMut, so we can't move there.
b-naber
commented
Feb 21, 2023
@bors r=jackh726 rollup |
bors
commented
Feb 21, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#104239 (Better debug logs for borrowck constraint graph) - rust-lang#108202 (Make sure `test_type_match` doesn't ICE with late-bound types) - rust-lang#108295 (Use DefKind to give more item kind information during BindingObligation note ) - rust-lang#108306 (compiletest: up deps) - rust-lang#108313 (Fix compiletest possible crash in option only-modified) - rust-lang#108322 (Clean ConstProp) - rust-lang#108323 (hir-analysis: make one diagnostic translatable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
There's a bad pattern matching confusion present in this function. `_anon` gets assigned to, and then `_anon` is used as an unbound variable in the pattern, which is unrelated to the first `_anon`. If the `_anon` didn't start with `_` the compiler would give warnings. This was introduced in rust-lang#104239. I have rewritten the function to remove the confusion and preserve the existing behaviour. This seems safest, because the original intent is not clear.
It's really cumbersome to work with
RegionVars when trying to debug borrowck code or when trying to understand how the borrowchecker works. This PR collects some region information (behindcfg(debug_assertions)) for createdRegionVars (NLL region vars, this PR doesn't touch canonicalization) and prints the nodes and edges of the strongly connected constraints graph using representatives that use that region information (either lifetime names, locations in MIR or spans).