Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 59c0f59

Browse files
committedMay 29, 2018
Auto merge of #51133 - spastorino:make_borrowck_use_output, r=nikomatsakis
Make borrowck use polonius output
2 parents 889d8dc + c3d6889 commit 59c0f59

File tree

9 files changed

+139
-74
lines changed

9 files changed

+139
-74
lines changed
 

‎src/Cargo.lock

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ dependencies = [
557557
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
558558
]
559559

560+
[[package]]
561+
name = "datafrog"
562+
version = "0.1.0"
563+
source = "registry+https://github.com/rust-lang/crates.io-index"
564+
560565
[[package]]
561566
name = "debug_unreachable"
562567
version = "0.1.1"
@@ -1450,8 +1455,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
14501455

14511456
[[package]]
14521457
name = "polonius-engine"
1453-
version = "0.1.1"
1458+
version = "0.4.0"
14541459
source = "registry+https://github.com/rust-lang/crates.io-index"
1460+
dependencies = [
1461+
"datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1462+
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1463+
]
14551464

14561465
[[package]]
14571466
name = "precomputed-hash"
@@ -1775,7 +1784,7 @@ dependencies = [
17751784
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
17761785
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
17771786
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1778-
"polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1787+
"polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
17791788
"proc_macro 0.0.0",
17801789
"rustc_apfloat 0.0.0",
17811790
"rustc_data_structures 0.0.0",
@@ -2159,10 +2168,11 @@ dependencies = [
21592168
"arena 0.0.0",
21602169
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
21612170
"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)",
21622172
"graphviz 0.0.0",
21632173
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
21642174
"log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2165-
"polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2175+
"polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
21662176
"rustc 0.0.0",
21672177
"rustc_apfloat 0.0.0",
21682178
"rustc_data_structures 0.0.0",
@@ -3069,6 +3079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
30693079
"checksum crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4"
30703080
"checksum curl 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "aaf20bbe084f285f215eef2165feed70d6b75ba29cad24469badb853a4a287d0"
30713081
"checksum curl-sys 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71c63a540a9ee4e15e56c3ed9b11a2f121239b9f6d7b7fe30f616e048148df9a"
3082+
"checksum datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d724bf4ffe77cdceeecd461009b5f8d9e23c5d645d68bedb4586bf43e7e142"
30723083
"checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"
30733084
"checksum derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ceed73957c449214f8440eec8ad7fa282b67dc9eacbb24a3085b15d60397a17a"
30743085
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
@@ -3162,7 +3173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31623173
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
31633174
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
31643175
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
3165-
"checksum polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6201ffe79e3da53bd065fbec2a9b391e5a0dc21038b39bb300612ddc658eb7ee"
3176+
"checksum polonius-engine 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9385a6d8f8ff6fd7e48a803c6a77fb89cc929dc7e2af6bf972494bbc8ff8b9e4"
31663177
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
31673178
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
31683179
"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"

‎src/librustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
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.1.1"
19+
polonius-engine = "0.4.0"
2020
proc_macro = { path = "../libproc_macro" }
2121
rustc_apfloat = { path = "../librustc_apfloat" }
2222
rustc_target = { path = "../librustc_target" }

‎src/librustc/session/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12961296
"dump facts from NLL analysis into side files"),
12971297
disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED],
12981298
"disable user provided type assertion in NLL"),
1299+
polonius: bool = (false, parse_bool, [UNTRACKED],
1300+
"enable polonius-based borrow-checker"),
12991301
codegen_time_graph: bool = (false, parse_bool, [UNTRACKED],
13001302
"generate a graphical HTML report of time spent in codegen and LLVM"),
13011303
thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],

‎src/librustc_mir/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ crate-type = ["dylib"]
1111
[dependencies]
1212
arena = { path = "../libarena" }
1313
bitflags = "1.0"
14+
either = "1.5.0"
1415
graphviz = { path = "../libgraphviz" }
1516
log = "0.4"
1617
log_settings = "0.1.1"
17-
polonius-engine = "0.1.1"
18+
polonius-engine = "0.4.0"
1819
rustc = { path = "../librustc" }
1920
rustc_target = { path = "../librustc_target" }
2021
rustc_data_structures = { path = "../librustc_data_structures" }

‎src/librustc_mir/borrow_check/flows.rs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@
1414
//! but is not as ugly as it is right now.
1515
1616
use rustc::mir::{BasicBlock, Location};
17+
use rustc::ty::RegionVid;
1718
use rustc_data_structures::indexed_set::Iter;
1819

19-
use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
20+
use borrow_check::location::LocationIndex;
21+
22+
use polonius_engine::Output;
23+
24+
use dataflow::move_paths::indexes::BorrowIndex;
25+
use dataflow::move_paths::HasMoveData;
26+
use dataflow::Borrows;
2027
use dataflow::{EverInitializedPlaces, MovingOutStatements};
21-
use dataflow::{Borrows};
2228
use dataflow::{FlowAtLocation, FlowsAtLocation};
23-
use dataflow::move_paths::HasMoveData;
24-
use dataflow::move_paths::indexes::BorrowIndex;
29+
use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
30+
use either::Either;
2531
use std::fmt;
32+
use std::rc::Rc;
2633

2734
// (forced to be `pub` due to its use as an associated type below.)
2835
crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> {
@@ -31,6 +38,9 @@ crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> {
3138
pub uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>,
3239
pub move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>,
3340
pub ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>,
41+
42+
/// Polonius Output
43+
pub polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>,
3444
}
3545

3646
impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
@@ -40,18 +50,27 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
4050
uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>,
4151
move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>,
4252
ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>,
53+
polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>,
4354
) -> Self {
4455
Flows {
4556
borrows,
4657
inits,
4758
uninits,
4859
move_outs,
4960
ever_inits,
61+
polonius_output,
5062
}
5163
}
5264

53-
crate fn borrows_in_scope(&self) -> impl Iterator<Item = BorrowIndex> + '_ {
54-
self.borrows.iter_incoming()
65+
crate fn borrows_in_scope(
66+
&self,
67+
location: LocationIndex,
68+
) -> impl Iterator<Item = BorrowIndex> + '_ {
69+
if let Some(ref polonius) = self.polonius_output {
70+
Either::Left(polonius.errors_at(location).iter().cloned())
71+
} else {
72+
Either::Right(self.borrows.iter_incoming())
73+
}
5574
}
5675

5776
crate fn with_outgoing_borrows(&self, op: impl FnOnce(Iter<BorrowIndex>)) {
@@ -66,7 +85,7 @@ macro_rules! each_flow {
6685
FlowAtLocation::$meth(&mut $this.uninits, $arg);
6786
FlowAtLocation::$meth(&mut $this.move_outs, $arg);
6887
FlowAtLocation::$meth(&mut $this.ever_inits, $arg);
69-
}
88+
};
7089
}
7190

7291
impl<'b, 'gcx, 'tcx> FlowsAtLocation for Flows<'b, 'gcx, 'tcx> {
@@ -134,8 +153,7 @@ impl<'b, 'gcx, 'tcx> fmt::Display for Flows<'b, 'gcx, 'tcx> {
134153
s.push_str(", ");
135154
};
136155
saw_one = true;
137-
let move_path =
138-
&self.uninits.operator().move_data().move_paths[mpi_uninit];
156+
let move_path = &self.uninits.operator().move_data().move_paths[mpi_uninit];
139157
s.push_str(&format!("{}", move_path));
140158
});
141159
s.push_str("] ");
@@ -159,8 +177,7 @@ impl<'b, 'gcx, 'tcx> fmt::Display for Flows<'b, 'gcx, 'tcx> {
159177
s.push_str(", ");
160178
};
161179
saw_one = true;
162-
let ever_init =
163-
&self.ever_inits.operator().move_data().inits[mpi_ever_init];
180+
let ever_init = &self.ever_inits.operator().move_data().inits[mpi_ever_init];
164181
s.push_str(&format!("{:?}", ever_init));
165182
});
166183
s.push_str("]");

‎src/librustc_mir/borrow_check/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
198198
let borrow_set = Rc::new(BorrowSet::build(tcx, mir));
199199

200200
// If we are in non-lexical mode, compute the non-lexical lifetimes.
201-
let (regioncx, opt_closure_req) = nll::compute_regions(
201+
let (regioncx, polonius_output, opt_closure_req) = nll::compute_regions(
202202
infcx,
203203
def_id,
204204
free_regions,
@@ -259,6 +259,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
259259
flow_uninits,
260260
flow_move_outs,
261261
flow_ever_inits,
262+
polonius_output,
262263
);
263264

264265
mbcx.analyze_results(&mut state); // entry point for DataflowResultsConsumer
@@ -936,6 +937,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
936937
let mut error_reported = false;
937938
let tcx = self.tcx;
938939
let mir = self.mir;
940+
let location_table = &LocationTable::new(mir);
941+
let location = location_table.start_index(context.loc);
939942
let borrow_set = self.borrow_set.clone();
940943
each_borrow_involving_path(
941944
self,
@@ -944,7 +947,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
944947
context,
945948
(sd, place_span.0),
946949
&borrow_set,
947-
flow_state.borrows_in_scope(),
950+
flow_state.borrows_in_scope(location),
948951
|this, borrow_index, borrow|
949952
match (rw, borrow.kind) {
950953
// Obviously an activation is compatible with its own

‎src/librustc_mir/borrow_check/nll/mod.rs

Lines changed: 84 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
// except according to those terms.
1010

1111
use borrow_check::borrow_set::BorrowSet;
12-
use borrow_check::location::LocationTable;
12+
use borrow_check::location::{LocationIndex, LocationTable};
1313
use borrow_check::nll::facts::AllFactsExt;
14+
use dataflow::indexes::BorrowIndex;
1415
use dataflow::move_paths::MoveData;
1516
use dataflow::FlowAtLocation;
1617
use dataflow::MaybeInitializedPlaces;
@@ -23,22 +24,24 @@ use std::collections::BTreeSet;
2324
use std::fmt::Debug;
2425
use std::io;
2526
use std::path::PathBuf;
27+
use std::rc::Rc;
2628
use transform::MirSource;
2729
use util::liveness::{LivenessResults, LocalSet};
2830

2931
use self::mir_util::PassWhere;
32+
use polonius_engine::{Algorithm, Output};
3033
use util as mir_util;
3134
use util::pretty::{self, ALIGN};
3235

3336
mod constraint_generation;
3437
pub mod explain_borrow;
3538
mod facts;
39+
mod invalidation;
3640
crate mod region_infer;
3741
mod renumber;
3842
mod subtype_constraint_generation;
3943
crate mod type_check;
4044
mod universal_regions;
41-
mod invalidation;
4245

4346
use self::facts::AllFacts;
4447
use self::region_infer::RegionInferenceContext;
@@ -83,6 +86,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
8386
borrow_set: &BorrowSet<'tcx>,
8487
) -> (
8588
RegionInferenceContext<'tcx>,
89+
Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>,
8690
Option<ClosureRegionRequirements<'gcx>>,
8791
) {
8892
// Run the MIR type-checker.
@@ -98,7 +102,9 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
98102
move_data,
99103
);
100104

101-
let mut all_facts = if infcx.tcx.sess.opts.debugging_opts.nll_facts {
105+
let mut all_facts = if infcx.tcx.sess.opts.debugging_opts.nll_facts
106+
|| infcx.tcx.sess.opts.debugging_opts.polonius
107+
{
102108
Some(AllFacts::default())
103109
} else {
104110
None
@@ -113,8 +119,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
113119
// Create the region inference context, taking ownership of the region inference
114120
// data that was contained in `infcx`.
115121
let var_origins = infcx.take_region_var_origins();
116-
let mut regioncx =
117-
RegionInferenceContext::new(var_origins, universal_regions, mir);
122+
let mut regioncx = RegionInferenceContext::new(var_origins, universal_regions, mir);
118123

119124
// Generate various constraints.
120125
subtype_constraint_generation::generate(
@@ -138,15 +143,28 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
138143
location_table,
139144
&mir,
140145
def_id,
141-
borrow_set
146+
borrow_set,
142147
);
143148

144149
// Dump facts if requested.
145-
if let Some(all_facts) = all_facts {
146-
let def_path = infcx.tcx.hir.def_path(def_id);
147-
let dir_path = PathBuf::from("nll-facts").join(def_path.to_filename_friendly_no_crate());
148-
all_facts.write_to_dir(dir_path, location_table).unwrap();
149-
}
150+
let polonius_output = all_facts.and_then(|all_facts| {
151+
if infcx.tcx.sess.opts.debugging_opts.nll_facts {
152+
let def_path = infcx.tcx.hir.def_path(def_id);
153+
let dir_path =
154+
PathBuf::from("nll-facts").join(def_path.to_filename_friendly_no_crate());
155+
all_facts.write_to_dir(dir_path, location_table).unwrap();
156+
}
157+
158+
if infcx.tcx.sess.opts.debugging_opts.polonius {
159+
Some(Rc::new(Output::compute(
160+
&all_facts,
161+
Algorithm::DatafrogOpt,
162+
false,
163+
)))
164+
} else {
165+
None
166+
}
167+
});
150168

151169
// Solve the region constraints.
152170
let closure_region_requirements = regioncx.solve(infcx, &mir, def_id);
@@ -166,7 +184,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
166184
// information
167185
dump_annotation(infcx, &mir, def_id, &regioncx, &closure_region_requirements);
168186

169-
(regioncx, closure_region_requirements)
187+
(regioncx, polonius_output, closure_region_requirements)
170188
}
171189

172190
fn dump_mir_results<'a, 'gcx, 'tcx>(
@@ -181,7 +199,8 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
181199
return;
182200
}
183201

184-
let regular_liveness_per_location: FxHashMap<_, _> = mir.basic_blocks()
202+
let regular_liveness_per_location: FxHashMap<_, _> = mir
203+
.basic_blocks()
185204
.indices()
186205
.flat_map(|bb| {
187206
let mut results = vec![];
@@ -194,7 +213,8 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
194213
})
195214
.collect();
196215

197-
let drop_liveness_per_location: FxHashMap<_, _> = mir.basic_blocks()
216+
let drop_liveness_per_location: FxHashMap<_, _> = mir
217+
.basic_blocks()
198218
.indices()
199219
.flat_map(|bb| {
200220
let mut results = vec![];
@@ -207,47 +227,55 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
207227
})
208228
.collect();
209229

210-
mir_util::dump_mir(infcx.tcx, None, "nll", &0, source, mir, |pass_where, out| {
211-
match pass_where {
212-
// Before the CFG, dump out the values for each region variable.
213-
PassWhere::BeforeCFG => {
214-
regioncx.dump_mir(out)?;
215-
216-
if let Some(closure_region_requirements) = closure_region_requirements {
217-
writeln!(out, "|")?;
218-
writeln!(out, "| Free Region Constraints")?;
219-
for_each_region_constraint(closure_region_requirements, &mut |msg| {
220-
writeln!(out, "| {}", msg)
221-
})?;
230+
mir_util::dump_mir(
231+
infcx.tcx,
232+
None,
233+
"nll",
234+
&0,
235+
source,
236+
mir,
237+
|pass_where, out| {
238+
match pass_where {
239+
// Before the CFG, dump out the values for each region variable.
240+
PassWhere::BeforeCFG => {
241+
regioncx.dump_mir(out)?;
242+
243+
if let Some(closure_region_requirements) = closure_region_requirements {
244+
writeln!(out, "|")?;
245+
writeln!(out, "| Free Region Constraints")?;
246+
for_each_region_constraint(closure_region_requirements, &mut |msg| {
247+
writeln!(out, "| {}", msg)
248+
})?;
249+
}
250+
}
251+
252+
// Before each basic block, dump out the values
253+
// that are live on entry to the basic block.
254+
PassWhere::BeforeBlock(bb) => {
255+
let s = live_variable_set(&liveness.regular.ins[bb], &liveness.drop.ins[bb]);
256+
writeln!(out, " | Live variables on entry to {:?}: {}", bb, s)?;
222257
}
223-
}
224258

225-
// Before each basic block, dump out the values
226-
// that are live on entry to the basic block.
227-
PassWhere::BeforeBlock(bb) => {
228-
let s = live_variable_set(&liveness.regular.ins[bb], &liveness.drop.ins[bb]);
229-
writeln!(out, " | Live variables on entry to {:?}: {}", bb, s)?;
230-
}
259+
PassWhere::BeforeLocation(location) => {
260+
let s = live_variable_set(
261+
&regular_liveness_per_location[&location],
262+
&drop_liveness_per_location[&location],
263+
);
264+
writeln!(
265+
out,
266+
"{:ALIGN$} | Live variables on entry to {:?}: {}",
267+
"",
268+
location,
269+
s,
270+
ALIGN = ALIGN
271+
)?;
272+
}
231273

232-
PassWhere::BeforeLocation(location) => {
233-
let s = live_variable_set(
234-
&regular_liveness_per_location[&location],
235-
&drop_liveness_per_location[&location],
236-
);
237-
writeln!(
238-
out,
239-
"{:ALIGN$} | Live variables on entry to {:?}: {}",
240-
"",
241-
location,
242-
s,
243-
ALIGN = ALIGN
244-
)?;
274+
PassWhere::AfterLocation(_) | PassWhere::AfterCFG => {}
245275
}
246-
247-
PassWhere::AfterLocation(_) | PassWhere::AfterCFG => {}
248-
}
249-
Ok(())
250-
});
276+
Ok(())
277+
},
278+
);
251279

252280
// Also dump the inference graph constraints as a graphviz file.
253281
let _: io::Result<()> = do catch {
@@ -278,7 +306,8 @@ fn dump_annotation<'a, 'gcx, 'tcx>(
278306
// better.
279307

280308
if let Some(closure_region_requirements) = closure_region_requirements {
281-
let mut err = tcx.sess
309+
let mut err = tcx
310+
.sess
282311
.diagnostic()
283312
.span_note_diag(mir.span, "External requirements");
284313

@@ -298,7 +327,8 @@ fn dump_annotation<'a, 'gcx, 'tcx>(
298327

299328
err.emit();
300329
} else {
301-
let mut err = tcx.sess
330+
let mut err = tcx
331+
.sess
302332
.diagnostic()
303333
.span_note_diag(mir.span, "No external requirements");
304334
regioncx.annotate(&mut err);
@@ -317,8 +347,7 @@ fn for_each_region_constraint(
317347
};
318348
with_msg(&format!(
319349
"where {:?}: {:?}",
320-
subject,
321-
req.outlived_free_region,
350+
subject, req.outlived_free_region,
322351
))?;
323352
}
324353
Ok(())

‎src/librustc_mir/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern crate arena;
3838
#[macro_use]
3939
extern crate bitflags;
4040
#[macro_use] extern crate log;
41+
extern crate either;
4142
extern crate graphviz as dot;
4243
extern crate polonius_engine;
4344
#[macro_use]

‎src/tools/tidy/src/deps.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static WHITELIST: &'static [Crate] = &[
7373
Crate("crossbeam-deque"),
7474
Crate("crossbeam-epoch"),
7575
Crate("crossbeam-utils"),
76+
Crate("datafrog"),
7677
Crate("either"),
7778
Crate("ena"),
7879
Crate("env_logger"),

0 commit comments

Comments
 (0)
Please sign in to comment.