@@ -23,10 +23,10 @@ use crate::borrow_set::BorrowSet;
2323use crate :: consumers:: RustcFacts ;
2424use crate :: diagnostics:: RegionErrors ;
2525use crate :: handle_placeholders:: compute_sccs_applying_placeholder_outlives_constraints;
26+ use crate :: polonius:: PoloniusContext ;
2627use crate :: polonius:: legacy:: {
2728 PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
2829} ;
29- use crate :: polonius:: { PoloniusContext , PoloniusDiagnosticsContext } ;
3030use crate :: region_infer:: RegionInferenceContext ;
3131use crate :: type_check:: MirTypeckRegionConstraints ;
3232use crate :: type_check:: free_region_relations:: UniversalRegionRelations ;
@@ -47,7 +47,7 @@ pub(crate) struct NllOutput<'tcx> {
4747
4848 /// When using `-Zpolonius=next`: the data used to compute errors and diagnostics, e.g.
4949 /// localized typeck and liveness constraints.
50- pub polonius_diagnostics : Option < PoloniusDiagnosticsContext > ,
50+ pub polonius_context : Option < PoloniusContext > ,
5151}
5252
5353/// Rewrites the regions in the MIR to use NLL variables, also scraping out the set of universal
@@ -122,7 +122,7 @@ pub(crate) fn compute_regions<'tcx>(
122122 universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
123123 constraints : MirTypeckRegionConstraints < ' tcx > ,
124124 mut polonius_facts : Option < AllFacts < RustcFacts > > ,
125- polonius_context : Option < PoloniusContext > ,
125+ mut polonius_context : Option < PoloniusContext > ,
126126) -> NllOutput < ' tcx > {
127127 let polonius_output = root_cx. consumer . as_ref ( ) . map_or ( false , |c| c. polonius_output ( ) )
128128 || infcx. tcx . sess . opts . unstable_opts . polonius . is_legacy_enabled ( ) ;
@@ -154,9 +154,9 @@ pub(crate) fn compute_regions<'tcx>(
154154
155155 // If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
156156 // and use them to compute loan liveness.
157- let polonius_diagnostics = polonius_context. map ( |polonius_context| {
158- polonius_context. compute_loan_liveness ( infcx . tcx , & mut regioncx, body, borrow_set)
159- } ) ;
157+ if let Some ( polonius_context ) = polonius_context. as_mut ( ) {
158+ polonius_context. compute_loan_liveness ( & mut regioncx, body, borrow_set)
159+ }
160160
161161 // If requested: dump NLL facts, and run legacy polonius analysis.
162162 let polonius_output = polonius_facts. as_ref ( ) . and_then ( |polonius_facts| {
@@ -189,7 +189,7 @@ pub(crate) fn compute_regions<'tcx>(
189189 polonius_output,
190190 opt_closure_req : closure_region_requirements,
191191 nll_errors,
192- polonius_diagnostics ,
192+ polonius_context ,
193193 }
194194}
195195
0 commit comments