@@ -22,10 +22,10 @@ use crate::borrow_set::BorrowSet;
2222use crate :: consumers:: RustcFacts ;
2323use crate :: diagnostics:: RegionErrors ;
2424use crate :: handle_placeholders:: compute_sccs_applying_placeholder_outlives_constraints;
25+ use crate :: polonius:: PoloniusContext ;
2526use crate :: polonius:: legacy:: {
2627 PoloniusFacts , PoloniusFactsExt , PoloniusLocationTable , PoloniusOutput ,
2728} ;
28- use crate :: polonius:: { PoloniusContext , PoloniusDiagnosticsContext } ;
2929use crate :: region_infer:: RegionInferenceContext ;
3030use crate :: type_check:: MirTypeckRegionConstraints ;
3131use crate :: type_check:: free_region_relations:: UniversalRegionRelations ;
@@ -46,7 +46,7 @@ pub(crate) struct NllOutput<'tcx> {
4646
4747 /// When using `-Zpolonius=next`: the data used to compute errors and diagnostics, e.g.
4848 /// localized typeck and liveness constraints.
49- pub polonius_diagnostics : Option < PoloniusDiagnosticsContext > ,
49+ pub polonius_context : Option < PoloniusContext > ,
5050}
5151
5252/// Rewrites the regions in the MIR to use NLL variables, also scraping out the set of universal
@@ -121,7 +121,7 @@ pub(crate) fn compute_regions<'tcx>(
121121 universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
122122 constraints : MirTypeckRegionConstraints < ' tcx > ,
123123 mut polonius_facts : Option < AllFacts < RustcFacts > > ,
124- polonius_context : Option < PoloniusContext > ,
124+ mut polonius_context : Option < PoloniusContext > ,
125125) -> NllOutput < ' tcx > {
126126 let polonius_output = root_cx. consumer . as_ref ( ) . map_or ( false , |c| c. polonius_output ( ) )
127127 || infcx. tcx . sess . opts . unstable_opts . polonius . is_legacy_enabled ( ) ;
@@ -153,9 +153,9 @@ pub(crate) fn compute_regions<'tcx>(
153153
154154 // If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
155155 // and use them to compute loan liveness.
156- let polonius_diagnostics = polonius_context. map ( |polonius_context| {
157- polonius_context. compute_loan_liveness ( infcx . tcx , & mut regioncx, body, borrow_set)
158- } ) ;
156+ if let Some ( polonius_context ) = polonius_context. as_mut ( ) {
157+ polonius_context. compute_loan_liveness ( & mut regioncx, body, borrow_set)
158+ }
159159
160160 // If requested: dump NLL facts, and run legacy polonius analysis.
161161 let polonius_output = polonius_facts. as_ref ( ) . and_then ( |polonius_facts| {
@@ -188,7 +188,7 @@ pub(crate) fn compute_regions<'tcx>(
188188 polonius_output,
189189 opt_closure_req : closure_region_requirements,
190190 nll_errors,
191- polonius_diagnostics ,
191+ polonius_context ,
192192 }
193193}
194194
0 commit comments