Skip to content

Commit c871637

Browse files
committed
Remove resolver.record_resolution().
1 parent 8fe525d commit c871637

File tree

3 files changed

+6
-33
lines changed

3 files changed

+6
-33
lines changed

src/librustc/hir/lowering.rs

+5-25
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ pub trait Resolver {
8282
// Obtain the resolution for a node id
8383
fn get_resolution(&mut self, id: NodeId) -> Option<PathResolution>;
8484

85-
// Record the resolution of a path or binding generated by the lowerer when expanding.
86-
fn record_resolution(&mut self, id: NodeId, def: Def);
87-
8885
// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
8986
// This should only return `None` during testing.
9087
fn definitions(&mut self) -> &mut Definitions;
@@ -351,12 +348,7 @@ impl<'a> LoweringContext<'a> {
351348
// Otherwise, the base path is an implicit `Self` type path,
352349
// e.g. `Vec` in `Vec::new` or `<I as Iterator>::Item` in
353350
// `<I as Iterator>::Item::default`.
354-
let ty = self.ty(p.span, hir::TyPath(hir::QPath::Resolved(qself, path)));
355-
356-
// Associate that innermost path type with the base Def.
357-
self.resolver.record_resolution(ty.id, resolution.base_def);
358-
359-
ty
351+
self.ty(p.span, hir::TyPath(hir::QPath::Resolved(qself, path)))
360352
};
361353

362354
// Anything after the base path are associated "extensions",
@@ -1902,10 +1894,8 @@ impl<'a> LoweringContext<'a> {
19021894
def: def,
19031895
segments: hir_vec![hir::PathSegment::from_name(id)],
19041896
})));
1905-
let expr = self.expr(span, expr_path, ThinVec::new());
1906-
self.resolver.record_resolution(expr.id, def);
19071897

1908-
expr
1898+
self.expr(span, expr_path, ThinVec::new())
19091899
}
19101900

19111901
fn expr_mut_addr_of(&mut self, span: Span, e: P<hir::Expr>) -> hir::Expr {
@@ -1918,10 +1908,7 @@ impl<'a> LoweringContext<'a> {
19181908
attrs: ThinVec<Attribute>)
19191909
-> hir::Expr {
19201910
let path = self.std_path(span, components, true);
1921-
let def = path.def;
1922-
let expr = self.expr(span, hir::ExprPath(hir::QPath::Resolved(None, P(path))), attrs);
1923-
self.resolver.record_resolution(expr.id, def);
1924-
expr
1911+
self.expr(span, hir::ExprPath(hir::QPath::Resolved(None, P(path))), attrs)
19251912
}
19261913

19271914
fn expr_match(&mut self,
@@ -1948,11 +1935,8 @@ impl<'a> LoweringContext<'a> {
19481935
e: Option<P<hir::Expr>>,
19491936
attrs: ThinVec<Attribute>) -> hir::Expr {
19501937
let path = self.std_path(span, components, false);
1951-
let def = path.def;
19521938
let qpath = hir::QPath::Resolved(None, P(path));
1953-
let expr = self.expr(span, hir::ExprStruct(qpath, fields, e), attrs);
1954-
self.resolver.record_resolution(expr.id, def);
1955-
expr
1939+
self.expr(span, hir::ExprStruct(qpath, fields, e), attrs)
19561940
}
19571941

19581942
fn expr(&mut self, span: Span, node: hir::Expr_, attrs: ThinVec<Attribute>) -> hir::Expr {
@@ -2021,16 +2005,13 @@ impl<'a> LoweringContext<'a> {
20212005
subpats: hir::HirVec<P<hir::Pat>>)
20222006
-> P<hir::Pat> {
20232007
let path = self.std_path(span, components, true);
2024-
let def = path.def;
20252008
let qpath = hir::QPath::Resolved(None, P(path));
20262009
let pt = if subpats.is_empty() {
20272010
hir::PatKind::Path(qpath)
20282011
} else {
20292012
hir::PatKind::TupleStruct(qpath, subpats, None)
20302013
};
2031-
let pat = self.pat(span, pt);
2032-
self.resolver.record_resolution(pat.id, def);
2033-
pat
2014+
self.pat(span, pt)
20342015
}
20352016

20362017
fn pat_ident(&mut self, span: Span, name: Name) -> P<hir::Pat> {
@@ -2047,7 +2028,6 @@ impl<'a> LoweringContext<'a> {
20472028
let def_index = defs.create_def_with_parent(parent_def, id, def_path_data);
20482029
DefId::local(def_index)
20492030
};
2050-
self.resolver.record_resolution(id, Def::Local(def_id));
20512031

20522032
P(hir::Pat {
20532033
id: id,

src/librustc_driver/driver.rs

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use rustc::hir;
1212
use rustc::hir::{map as hir_map, FreevarMap, TraitMap};
13-
use rustc::hir::def::DefMap;
1413
use rustc::hir::lowering::lower_crate;
1514
use rustc_data_structures::blake2b::Blake2bHasher;
1615
use rustc_data_structures::fmt_wrap::FmtWrap;
@@ -63,7 +62,6 @@ use derive_registrar;
6362

6463
#[derive(Clone)]
6564
pub struct Resolutions {
66-
pub def_map: DefMap,
6765
pub freevars: FreevarMap,
6866
pub trait_map: TraitMap,
6967
pub maybe_unused_trait_imports: NodeSet,
@@ -794,7 +792,6 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
794792
hir_ty_to_ty: NodeMap(),
795793
},
796794
resolutions: Resolutions {
797-
def_map: resolver.def_map,
798795
freevars: resolver.freevars,
799796
trait_map: resolver.trait_map,
800797
maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,

src/librustc_resolve/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ pub struct Resolver<'a> {
10501050
// The idents for the primitive types.
10511051
primitive_type_table: PrimitiveTypeTable,
10521052

1053-
pub def_map: DefMap,
1053+
def_map: DefMap,
10541054
pub freevars: FreevarMap,
10551055
freevars_seen: NodeMap<NodeMap<usize>>,
10561056
pub export_map: ExportMap,
@@ -1183,10 +1183,6 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
11831183
self.def_map.get(&id).cloned()
11841184
}
11851185

1186-
fn record_resolution(&mut self, id: NodeId, def: Def) {
1187-
self.def_map.insert(id, PathResolution::new(def));
1188-
}
1189-
11901186
fn definitions(&mut self) -> &mut Definitions {
11911187
&mut self.definitions
11921188
}

0 commit comments

Comments
 (0)