Skip to content

Commit 90f34b5

Browse files
committed
Auto merge of #51246 - vakaras:select_polonius_algo_via_env_var, r=nikomatsakis
Select Polonius algorithm via `POLONIUS_ALGORITHM` environment variable This pull request allows selecting the Polonius algorithm being used by providing an environment variable `POLONIUS_ALGORITHM`. Example usage: ``` POLONIUS_ALGORITHM=compare RUST_LOG=rustc_mir::borrow_check::nll=trace ./x.py test --stage 1 --compare-mode polonius -- src/test/ui/nll/issue-47680.rs ... stderr: ------------------------------------------ INFO 2018-05-31T17:35:31Z: rustc_mir::borrow_check::nll: Using Polonius algorithm: Compare INFO 2018-05-31T17:35:31Z: rustc_mir::borrow_check::nll: Using Polonius algorithm: Compare ------------------------------------------ ... ``` r? @nikomatsakis
2 parents 4122885 + 265b04d commit 90f34b5

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

src/Cargo.lock

+5-4
Original file line numberDiff line numberDiff line change
@@ -1456,10 +1456,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
14561456

14571457
[[package]]
14581458
name = "polonius-engine"
1459-
version = "0.4.0"
1459+
version = "0.5.0"
14601460
source = "registry+https://github.com/rust-lang/crates.io-index"
14611461
dependencies = [
14621462
"datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1463+
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
14631464
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
14641465
]
14651466

@@ -1785,7 +1786,7 @@ dependencies = [
17851786
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
17861787
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
17871788
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1788-
"polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1789+
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
17891790
"proc_macro 0.0.0",
17901791
"rustc_apfloat 0.0.0",
17911792
"rustc_data_structures 0.0.0",
@@ -2174,7 +2175,7 @@ dependencies = [
21742175
"graphviz 0.0.0",
21752176
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
21762177
"log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2177-
"polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
2178+
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
21782179
"rustc 0.0.0",
21792180
"rustc_apfloat 0.0.0",
21802181
"rustc_data_structures 0.0.0",
@@ -3176,7 +3177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31763177
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
31773178
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
31783179
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
3179-
"checksum polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9385a6d8f8ff6fd7e48a803c6a77fb89cc929dc7e2af6bf972494bbc8ff8b9e4"
3180+
"checksum polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b6b0a7f5f4278b991ffd14abce1d01b013121ad297460237ef0a2f08d43201"
31803181
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
31813182
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
31823183
"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ graphviz = { path = "../libgraphviz" }
1616
jobserver = "0.1"
1717
lazy_static = "1.0.0"
1818
log = { version = "0.4", features = ["release_max_level_info", "std"] }
19-
polonius-engine = "0.4.0"
19+
polonius-engine = "0.5.0"
2020
proc_macro = { path = "../libproc_macro" }
2121
rustc_apfloat = { path = "../librustc_apfloat" }
2222
rustc_target = { path = "../librustc_target" }

src/librustc_mir/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ either = "1.5.0"
1515
graphviz = { path = "../libgraphviz" }
1616
log = "0.4"
1717
log_settings = "0.1.1"
18-
polonius-engine = "0.4.0"
18+
polonius-engine = "0.5.0"
1919
rustc = { path = "../librustc" }
2020
rustc_target = { path = "../librustc_target" }
2121
rustc_data_structures = { path = "../librustc_data_structures" }

src/librustc_mir/borrow_check/nll/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ use rustc::ty::{self, RegionKind, RegionVid};
2222
use rustc::util::nodemap::FxHashMap;
2323
use std::collections::BTreeSet;
2424
use std::fmt::Debug;
25+
use std::env;
2526
use std::io;
2627
use std::path::PathBuf;
2728
use std::rc::Rc;
29+
use std::str::FromStr;
2830
use transform::MirSource;
2931
use util::liveness::{LivenessResults, LocalSet};
3032

@@ -156,9 +158,13 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
156158
}
157159

158160
if infcx.tcx.sess.opts.debugging_opts.polonius {
161+
let algorithm = env::var("POLONIUS_ALGORITHM")
162+
.unwrap_or(String::from("DatafrogOpt"));
163+
let algorithm = Algorithm::from_str(&algorithm).unwrap();
164+
debug!("compute_regions: using polonius algorithm {:?}", algorithm);
159165
Some(Rc::new(Output::compute(
160166
&all_facts,
161-
Algorithm::DatafrogOpt,
167+
algorithm,
162168
false,
163169
)))
164170
} else {

0 commit comments

Comments
 (0)