Skip to content

Commit

Permalink
Various nits.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Feb 13, 2015
1 parent 88fcf83 commit b6461f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,14 @@ pub struct ctxt<'tcx> {
pub types: CommonTypes<'tcx>,

pub sess: Session,

// NDM -- can we add a comment explaining the relationship of
// these two maps? Or maybe make partialdefs be a variant of def?
// These two maps store the result of path resolution. For any
// given path, there will be an entry in one map or the other.
pub def_map: DefMap,
pub partial_def_map: PartialDefMap,

pub last_private_map: RefCell<LastPrivateMap>,

pub named_region_map: resolve_lifetime::NamedRegionMap,
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3513,6 +3513,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
path_depth: usize,
namespace: Namespace,
check_ribs: bool) -> Option<(Def, LastPrivate, usize)> {
// NDM ^~~~~~~~~~~~~~~~~~~~~~~~~
// NDM this seems like a case for a named struct

let span = path.span;
let segments = &path.segments[..path.segments.len()-path_depth];

Expand Down
5 changes: 3 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{
let tcx = self.tcx();

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

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

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

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

0 comments on commit b6461f0

Please sign in to comment.