1
Fork 0

Add environment variable tracking in places where it was convenient

This won't work with Cargo's change tracking, but it should work with incremental.
This commit is contained in:
Mads Marquart 2024-12-01 11:55:46 +01:00
parent 17db054141
commit 632ce38c9a
2 changed files with 7 additions and 6 deletions

View file

@ -1,9 +1,9 @@
//! The entry point of the NLL borrow checker.
use std::io;
use std::path::PathBuf;
use std::rc::Rc;
use std::str::FromStr;
use std::{env, io};
use polonius_engine::{Algorithm, Output};
use rustc_index::IndexSlice;
@ -162,9 +162,8 @@ pub(crate) fn compute_regions<'a, 'tcx>(
}
if polonius_output {
let algorithm =
env::var("POLONIUS_ALGORITHM").unwrap_or_else(|_| String::from("Hybrid"));
let algorithm = Algorithm::from_str(&algorithm).unwrap();
let algorithm = infcx.tcx.env_var("POLONIUS_ALGORITHM").unwrap_or("Hybrid");
let algorithm = Algorithm::from_str(algorithm).unwrap();
debug!("compute_regions: using polonius algorithm {:?}", algorithm);
let _prof_timer = infcx.tcx.prof.generic_activity("polonius_analysis");
Some(Box::new(Output::compute(polonius_facts, algorithm, false)))