Skip to content

Commit

Permalink
Rollup merge of rust-lang#61803 - Centril:write_resolution, r=petroch…
Browse files Browse the repository at this point in the history
…enkov

typeck: small refactoring, add 'fn write_resolution'
  • Loading branch information
Centril authored Jun 14, 2019
2 parents e17e8a3 + a17e918 commit 0abd50f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2208,15 +2208,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.tables.borrow_mut().field_indices_mut().insert(hir_id, index);
}

fn write_resolution(&self, hir_id: hir::HirId, r: Result<(DefKind, DefId), ErrorReported>) {
self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, r);
}

pub fn write_method_call(&self,
hir_id: hir::HirId,
method: MethodCallee<'tcx>) {
debug!("write_method_call(hir_id={:?}, method={:?})", hir_id, method);
self.tables
.borrow_mut()
.type_dependent_defs_mut()
.insert(hir_id, Ok((DefKind::Method, method.def_id)));

self.write_resolution(hir_id, Ok((DefKind::Method, method.def_id)));
self.write_substs(hir_id, method.substs);

// When the method is confirmed, the `method.substs` includes
Expand Down Expand Up @@ -4724,7 +4724,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let result = result.map(|(_, kind, def_id)| (kind, def_id));

// Write back the new resolution.
self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, result);
self.write_resolution(hir_id, result);

(result.map(|(kind, def_id)| Res::Def(kind, def_id)).unwrap_or(Res::Err), ty)
}
Expand Down Expand Up @@ -4777,7 +4777,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
});

// Write back the new resolution.
self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, result);
self.write_resolution(hir_id, result);
(
result.map(|(kind, def_id)| Res::Def(kind, def_id)).unwrap_or(Res::Err),
Some(ty),
Expand Down

0 comments on commit 0abd50f

Please sign in to comment.