Skip to content

Commit b6461f0

Browse files
committed
Various nits.
1 parent 88fcf83 commit b6461f0

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/librustc/middle/ty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,14 @@ pub struct ctxt<'tcx> {
678678
pub types: CommonTypes<'tcx>,
679679

680680
pub sess: Session,
681+
682+
// NDM -- can we add a comment explaining the relationship of
683+
// these two maps? Or maybe make partialdefs be a variant of def?
684+
// These two maps store the result of path resolution. For any
685+
// given path, there will be an entry in one map or the other.
681686
pub def_map: DefMap,
682687
pub partial_def_map: PartialDefMap,
688+
683689
pub last_private_map: RefCell<LastPrivateMap>,
684690

685691
pub named_region_map: resolve_lifetime::NamedRegionMap,

src/librustc_resolve/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,6 +3513,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
35133513
path_depth: usize,
35143514
namespace: Namespace,
35153515
check_ribs: bool) -> Option<(Def, LastPrivate, usize)> {
3516+
// NDM ^~~~~~~~~~~~~~~~~~~~~~~~~
3517+
// NDM this seems like a case for a named struct
3518+
35163519
let span = path.span;
35173520
let segments = &path.segments[..path.segments.len()-path_depth];
35183521

src/librustc_typeck/check/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15931593
{
15941594
let tcx = self.tcx();
15951595

1596+
// Nit: call it scheme
15961597
let pty = ty::lookup_item_type(tcx, did);
15971598

15981599
let substs = astconv::ast_path_substs_for_ty(self, self,
@@ -3609,8 +3610,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
36093610
};
36103611

36113612
// Helpers to avoid keeping the RefCell borrow for too long.
3612-
let get_def = |&:| tcx.def_map.borrow().get(&id).cloned();
3613-
let get_partial_def = |&:| tcx.partial_def_map.borrow().get(&id).cloned();
3613+
let get_def = || tcx.def_map.borrow().get(&id).cloned();
3614+
let get_partial_def = || tcx.partial_def_map.borrow().get(&id).cloned();
36143615

36153616
if let Some(def) = get_def() {
36163617
let pty = type_scheme_for_def(fcx, expr.span, def);

0 commit comments

Comments
 (0)