diff options
| author | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2025-08-06 11:12:51 +0200 |
|---|---|---|
| committer | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2025-08-06 11:12:51 +0200 |
| commit | bcefc2ee977e38a4a5ecd0956e19b0968d33052b (patch) | |
| tree | e721e4fafea67a36f8b1c9b6e1cca39196aad242 | |
| parent | ec7c02612527d185c379900b613311bc1dcbf7dc (diff) | |
| download | rust-bcefc2ee977e38a4a5ecd0956e19b0968d33052b.tar.gz rust-bcefc2ee977e38a4a5ecd0956e19b0968d33052b.zip | |
Add annotations to the graphviz region graph on region origins
This adds - (ex) for regions whose origin is existential, - (p) for regoins whose origin is a placeholder, and - (p for <name>) if the originating placeholder is named. This has helped _my_ debugging and it doesn't create too bad clutter, I feel. The change is ridiculously small, but I turned it into a separate PR so we can bikeshed the format.
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/graphviz.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/graphviz.rs b/compiler/rustc_borrowck/src/region_infer/graphviz.rs index a3e29982e90..899dde9ecd4 100644 --- a/compiler/rustc_borrowck/src/region_infer/graphviz.rs +++ b/compiler/rustc_borrowck/src/region_infer/graphviz.rs @@ -41,7 +41,21 @@ fn render_region_vid<'tcx>( "".to_string() }; - format!("{:?}{universe_str}{external_name_str}", rvid) + let extra_info = match regioncx.region_definition(rvid).origin { + NllRegionVariableOrigin::FreeRegion => "".to_string(), + NllRegionVariableOrigin::Placeholder(p) => match p.bound.kind { + ty::BoundRegionKind::Named(def_id) => { + format!("(p for {})", tcx.item_name(def_id)) + } + ty::BoundRegionKind::ClosureEnv | ty::BoundRegionKind::Anon => "(p)".to_string(), + ty::BoundRegionKind::NamedAnon(_) => { + bug!("only used for pretty printing") + } + }, + NllRegionVariableOrigin::Existential { .. } => "(ex)".to_string(), + }; + + format!("{:?}{universe_str}{external_name_str}{extra_info}", rvid) } impl<'tcx> RegionInferenceContext<'tcx> { |
