summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2018-05-29 08:54:15 -0300
committerSantiago Pastorino <spastorino@gmail.com>2018-05-29 10:19:46 -0300
commit9de4e342dfc84c66d4ab435adcafc930c35f5586 (patch)
tree2be802a50f6c9dd3d6c22db153b133cc421d5979 /src
parentstore output in FlowState (diff)
downloadgrust-9de4e342dfc84c66d4ab435adcafc930c35f5586.tar.gz
grust-9de4e342dfc84c66d4ab435adcafc930c35f5586.tar.bz2
grust-9de4e342dfc84c66d4ab435adcafc930c35f5586.tar.xz
Use polonius_output
Diffstat (limited to 'src')
-rw-r--r--src/Cargo.lock9
-rw-r--r--src/librustc/Cargo.toml2
-rw-r--r--src/librustc_mir/Cargo.toml3
-rw-r--r--src/librustc_mir/borrow_check/flows.rs9
-rw-r--r--src/librustc_mir/borrow_check/mod.rs4
-rw-r--r--src/librustc_mir/lib.rs1
6 files changed, 19 insertions, 9 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 413ae2db2c..6b7c165826 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -1455,7 +1455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1455 1455
1456[[package]] 1456[[package]]
1457name = "polonius-engine" 1457name = "polonius-engine"
1458version = "0.2.0" 1458version = "0.4.0"
1459source = "registry+https://github.com/rust-lang/crates.io-index" 1459source = "registry+https://github.com/rust-lang/crates.io-index"
1460dependencies = [ 1460dependencies = [
1461 "datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1461 "datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1784,7 +1784,7 @@ dependencies = [
1784 "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", 1784 "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
1785 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 1785 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
1786 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", 1786 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1787 "polonius-engine 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 1787 "polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1788 "proc_macro 0.0.0", 1788 "proc_macro 0.0.0",
1789 "rustc_apfloat 0.0.0", 1789 "rustc_apfloat 0.0.0",
1790 "rustc_data_structures 0.0.0", 1790 "rustc_data_structures 0.0.0",
@@ -2168,10 +2168,11 @@ dependencies = [
2168 "arena 0.0.0", 2168 "arena 0.0.0",
2169 "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 2169 "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2170 "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 2170 "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
2171 "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
2171 "graphviz 0.0.0", 2172 "graphviz 0.0.0",
2172 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", 2173 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
2173 "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 2174 "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2174 "polonius-engine 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 2175 "polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
2175 "rustc 0.0.0", 2176 "rustc 0.0.0",
2176 "rustc_apfloat 0.0.0", 2177 "rustc_apfloat 0.0.0",
2177 "rustc_data_structures 0.0.0", 2178 "rustc_data_structures 0.0.0",
@@ -3172,7 +3173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3172"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" 3173"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
3173"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" 3174"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
3174"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" 3175"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
3175"checksum polonius-engine 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89be86c0ed0f63715d74d390b1a1a3df63cfca80b6eab604d7c4fecb5403cfdd" 3176"checksum polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9385a6d8f8ff6fd7e48a803c6a77fb89cc929dc7e2af6bf972494bbc8ff8b9e4"
3176"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" 3177"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
3177"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" 3178"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
3178"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118" 3179"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"
diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml
index 535fb2fcc3..df68bf1fd9 100644
--- a/src/librustc/Cargo.toml
+++ b/src/librustc/Cargo.toml
@@ -16,7 +16,7 @@ graphviz = { path = "../libgraphviz" }
16jobserver = "0.1" 16jobserver = "0.1"
17lazy_static = "1.0.0" 17lazy_static = "1.0.0"
18log = { version = "0.4", features = ["release_max_level_info", "std"] } 18log = { version = "0.4", features = ["release_max_level_info", "std"] }
19polonius-engine = "0.2.0" 19polonius-engine = "0.4.0"
20proc_macro = { path = "../libproc_macro" } 20proc_macro = { path = "../libproc_macro" }
21rustc_apfloat = { path = "../librustc_apfloat" } 21rustc_apfloat = { path = "../librustc_apfloat" }
22rustc_target = { path = "../librustc_target" } 22rustc_target = { path = "../librustc_target" }
diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml
index c2cfd3a827..512ab53f40 100644
--- a/src/librustc_mir/Cargo.toml
+++ b/src/librustc_mir/Cargo.toml
@@ -11,10 +11,11 @@ crate-type = ["dylib"]
11[dependencies] 11[dependencies]
12arena = { path = "../libarena" } 12arena = { path = "../libarena" }
13bitflags = "1.0" 13bitflags = "1.0"
14either = "1.5.0"
14graphviz = { path = "../libgraphviz" } 15graphviz = { path = "../libgraphviz" }
15log = "0.4" 16log = "0.4"
16log_settings = "0.1.1" 17log_settings = "0.1.1"
17polonius-engine = "0.2.0" 18polonius-engine = "0.4.0"
18rustc = { path = "../librustc" } 19rustc = { path = "../librustc" }
19rustc_target = { path = "../librustc_target" } 20rustc_target = { path = "../librustc_target" }
20rustc_data_structures = { path = "../librustc_data_structures" } 21rustc_data_structures = { path = "../librustc_data_structures" }
diff --git a/src/librustc_mir/borrow_check/flows.rs b/src/librustc_mir/borrow_check/flows.rs
index 61915646d6..5d13eab8cf 100644
--- a/src/librustc_mir/borrow_check/flows.rs
+++ b/src/librustc_mir/borrow_check/flows.rs
@@ -27,6 +27,7 @@ use dataflow::{Borrows};
27use dataflow::{FlowAtLocation, FlowsAtLocation}; 27use dataflow::{FlowAtLocation, FlowsAtLocation};
28use dataflow::move_paths::HasMoveData; 28use dataflow::move_paths::HasMoveData;
29use dataflow::move_paths::indexes::BorrowIndex; 29use dataflow::move_paths::indexes::BorrowIndex;
30use either::Either;
30use std::fmt; 31use std::fmt;
31use std::rc::Rc; 32use std::rc::Rc;
32 33
@@ -61,8 +62,12 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
61 } 62 }
62 } 63 }
63 64
64 crate fn borrows_in_scope(&self) -> impl Iterator<Item = BorrowIndex> + '_ { 65 crate fn borrows_in_scope(&self, location: LocationIndex) -> impl Iterator<Item = BorrowIndex> + '_ {
65 self.borrows.iter_incoming() 66 if let Some(ref polonius) = self.polonius_output {
67 Either::Left(polonius.errors_at(location).iter().cloned())
68 } else {
69 Either::Right(self.borrows.iter_incoming())
70 }
66 } 71 }
67 72
68 crate fn with_outgoing_borrows(&self, op: impl FnOnce(Iter<BorrowIndex>)) { 73 crate fn with_outgoing_borrows(&self, op: impl FnOnce(Iter<BorrowIndex>)) {
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 983a2ac2ec..9bfba219cc 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -937,6 +937,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
937 let mut error_reported = false; 937 let mut error_reported = false;
938 let tcx = self.tcx; 938 let tcx = self.tcx;
939 let mir = self.mir; 939 let mir = self.mir;
940 let location_table = &LocationTable::new(mir);
941 let location = location_table.start_index(context.loc);
940 let borrow_set = self.borrow_set.clone(); 942 let borrow_set = self.borrow_set.clone();
941 each_borrow_involving_path( 943 each_borrow_involving_path(
942 self, 944 self,
@@ -945,7 +947,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
945 context, 947 context,
946 (sd, place_span.0), 948 (sd, place_span.0),
947 &borrow_set, 949 &borrow_set,
948 flow_state.borrows_in_scope(), 950 flow_state.borrows_in_scope(location),
949 |this, borrow_index, borrow| 951 |this, borrow_index, borrow|
950 match (rw, borrow.kind) { 952 match (rw, borrow.kind) {
951 // Obviously an activation is compatible with its own 953 // Obviously an activation is compatible with its own
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index ace4709ba1..34eb444fdc 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -38,6 +38,7 @@ extern crate arena;
38#[macro_use] 38#[macro_use]
39extern crate bitflags; 39extern crate bitflags;
40#[macro_use] extern crate log; 40#[macro_use] extern crate log;
41extern crate either;
41extern crate graphviz as dot; 42extern crate graphviz as dot;
42extern crate polonius_engine; 43extern crate polonius_engine;
43#[macro_use] 44#[macro_use]