Skip to content

Commit 8698117

Browse files
committed
do not give ownership of the InferCtxt away
1 parent fab632f commit 8698117

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc/infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,15 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
430430
}
431431

432432
pub fn enter<F, R>(&'tcx mut self, f: F) -> R
433-
where F: for<'b> FnOnce(InferCtxt<'b, 'gcx, 'tcx>) -> R
433+
where F: for<'b> FnOnce(&InferCtxt<'b, 'gcx, 'tcx>) -> R
434434
{
435435
let InferCtxtBuilder {
436436
global_tcx,
437437
ref arena,
438438
ref fresh_tables,
439439
} = *self;
440440
let in_progress_tables = fresh_tables.as_ref();
441-
global_tcx.enter_local(arena, |tcx| f(InferCtxt {
441+
global_tcx.enter_local(arena, |tcx| f(&InferCtxt {
442442
tcx,
443443
in_progress_tables,
444444
projection_cache: RefCell::new(traits::ProjectionCache::new()),

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'a, 'tcx> MaybeInProgressTables<'a, 'tcx> {
189189
/// `bar()` will each have their own `FnCtxt`, but they will
190190
/// share the inherited fields.
191191
pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
192-
infcx: InferCtxt<'a, 'gcx, 'tcx>,
192+
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
193193

194194
tables: MaybeInProgressTables<'a, 'tcx>,
195195

@@ -620,7 +620,7 @@ impl<'a, 'gcx, 'tcx> InheritedBuilder<'a, 'gcx, 'tcx> {
620620
}
621621

622622
impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> {
623-
fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self {
623+
fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self {
624624
let tcx = infcx.tcx;
625625
let item_id = tcx.hir.as_local_node_id(def_id);
626626
let body_id = item_id.and_then(|id| tcx.hir.maybe_body_owned_by(id));

0 commit comments

Comments
 (0)