Skip to content

Commit 7839827

Browse files
committed
Auto merge of #29581 - gereeter:unwrap-defmap-refcell, r=nrc
This is basically a more conservative recreation of #24096.
2 parents effcd29 + b1788ef commit 7839827

File tree

18 files changed

+53
-51
lines changed

18 files changed

+53
-51
lines changed

src/librustc/middle/cfg/construct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
472472
let guard_exit = self.expr(&**guard, guard_start);
473473

474474
let this_has_bindings = pat_util::pat_contains_bindings_or_wild(
475-
&self.tcx.def_map, &**pat);
475+
&self.tcx.def_map.borrow(), &**pat);
476476

477477
// If both this pattern and the previous pattern
478478
// were free of bindings, they must consist only

src/librustc/middle/check_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ fn is_useful(cx: &MatchCheckCtxt,
702702

703703
Some(constructor) => {
704704
let matrix = rows.iter().filter_map(|r| {
705-
if pat_is_binding_or_wild(&cx.tcx.def_map, raw_pat(r[0])) {
705+
if pat_is_binding_or_wild(&cx.tcx.def_map.borrow(), raw_pat(r[0])) {
706706
Some(r[1..].to_vec())
707707
} else {
708708
None
@@ -1073,7 +1073,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
10731073
// check legality of moving out of the enum
10741074

10751075
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
1076-
if sub.map_or(false, |p| pat_contains_bindings(def_map, &*p)) {
1076+
if sub.map_or(false, |p| pat_contains_bindings(&def_map.borrow(), &*p)) {
10771077
span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings");
10781078
} else if has_guard {
10791079
span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard");
@@ -1086,7 +1086,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
10861086

10871087
for pat in pats {
10881088
front_util::walk_pat(&**pat, |p| {
1089-
if pat_is_binding(def_map, &*p) {
1089+
if pat_is_binding(&def_map.borrow(), &*p) {
10901090
match p.node {
10911091
hir::PatIdent(hir::BindByValue(_), _, ref sub) => {
10921092
let pat_ty = tcx.node_id_to_type(p.id);
@@ -1181,7 +1181,7 @@ struct AtBindingPatternVisitor<'a, 'b:'a, 'tcx:'b> {
11811181

11821182
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
11831183
fn visit_pat(&mut self, pat: &Pat) {
1184-
if !self.bindings_allowed && pat_is_binding(&self.cx.tcx.def_map, pat) {
1184+
if !self.bindings_allowed && pat_is_binding(&self.cx.tcx.def_map.borrow(), pat) {
11851185
span_err!(self.cx.tcx.sess, pat.span, E0303,
11861186
"pattern bindings are not allowed \
11871187
after an `@`");

src/librustc/middle/check_static_recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'ast> {
237237
fn visit_expr(&mut self, e: &'ast hir::Expr) {
238238
match e.node {
239239
hir::ExprPath(..) => {
240-
match self.def_map.borrow().get(&e.id).map(|d| d.base_def) {
240+
match self.def_map.get(&e.id).map(|d| d.base_def) {
241241
Some(DefStatic(def_id, _)) |
242242
Some(DefAssociatedConst(def_id)) |
243243
Some(DefConst(def_id)) => {

src/librustc/middle/dead.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
250250
fn visit_arm(&mut self, arm: &hir::Arm) {
251251
if arm.pats.len() == 1 {
252252
let pat = &*arm.pats[0];
253-
let variants = pat_util::necessary_variants(&self.tcx.def_map, pat);
253+
let variants = pat_util::necessary_variants(&self.tcx.def_map.borrow(), pat);
254254

255255
// Inside the body, ignore constructions of variants
256256
// necessary for the pattern to match. Those construction sites
@@ -270,7 +270,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
270270
hir::PatStruct(_, ref fields, _) => {
271271
self.handle_field_pattern_match(pat, fields);
272272
}
273-
_ if pat_util::pat_is_const(def_map, pat) => {
273+
_ if pat_util::pat_is_const(&def_map.borrow(), pat) => {
274274
// it might be the only use of a const
275275
self.lookup_and_handle_definition(&pat.id)
276276
}

src/librustc/middle/def.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use util::nodemap::NodeMap;
1717
use syntax::ast;
1818
use rustc_front::hir;
1919

20-
use std::cell::RefCell;
21-
2220
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
2321
pub enum Def {
2422
DefFn(DefId, bool /* is_ctor */),
@@ -103,7 +101,7 @@ impl PathResolution {
103101
}
104102

105103
// Definition mapping
106-
pub type DefMap = RefCell<NodeMap<PathResolution>>;
104+
pub type DefMap = NodeMap<PathResolution>;
107105
// This is the replacement export map. It maps a module to all of the exports
108106
// within.
109107
pub type ExportMap = NodeMap<Vec<Export>>;

src/librustc/middle/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
934934
return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |_mc, cmt_pat, pat| {
935935
let tcx = self.tcx();
936936
let def_map = &self.tcx().def_map;
937-
if pat_util::pat_is_binding(def_map, pat) {
937+
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
938938
match pat.node {
939939
hir::PatIdent(hir::BindByRef(_), _, _) =>
940940
mode.lub(BorrowingMatch),
@@ -969,7 +969,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
969969
let def_map = &self.tcx().def_map;
970970
let delegate = &mut self.delegate;
971971
return_if_err!(mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
972-
if pat_util::pat_is_binding(def_map, pat) {
972+
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
973973
let tcx = typer.tcx;
974974

975975
debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",

src/librustc/middle/pat_util.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ use rustc_front::hir;
1818
use rustc_front::util::walk_pat;
1919
use syntax::codemap::{respan, Span, Spanned, DUMMY_SP};
2020

21+
use std::cell::RefCell;
22+
2123
pub type PatIdMap = FnvHashMap<ast::Name, ast::NodeId>;
2224

2325
// This is used because same-named variables in alternative patterns need to
2426
// use the NodeId of their namesake in the first pattern.
25-
pub fn pat_id_map(dm: &DefMap, pat: &hir::Pat) -> PatIdMap {
27+
pub fn pat_id_map(dm: &RefCell<DefMap>, pat: &hir::Pat) -> PatIdMap {
2628
let mut map = FnvHashMap();
2729
pat_bindings(dm, pat, |_bm, p_id, _s, path1| {
2830
map.insert(path1.node, p_id);
@@ -36,7 +38,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
3638
hir::PatEnum(_, _) |
3739
hir::PatIdent(_, _, None) |
3840
hir::PatStruct(..) => {
39-
match dm.borrow().get(&pat.id).map(|d| d.full_def()) {
41+
match dm.get(&pat.id).map(|d| d.full_def()) {
4042
Some(DefVariant(..)) => true,
4143
_ => false
4244
}
@@ -51,7 +53,7 @@ pub fn pat_is_variant_or_struct(dm: &DefMap, pat: &hir::Pat) -> bool {
5153
hir::PatEnum(_, _) |
5254
hir::PatIdent(_, _, None) |
5355
hir::PatStruct(..) => {
54-
match dm.borrow().get(&pat.id).map(|d| d.full_def()) {
56+
match dm.get(&pat.id).map(|d| d.full_def()) {
5557
Some(DefVariant(..)) | Some(DefStruct(..)) => true,
5658
_ => false
5759
}
@@ -63,7 +65,7 @@ pub fn pat_is_variant_or_struct(dm: &DefMap, pat: &hir::Pat) -> bool {
6365
pub fn pat_is_const(dm: &DefMap, pat: &hir::Pat) -> bool {
6466
match pat.node {
6567
hir::PatIdent(_, _, None) | hir::PatEnum(..) | hir::PatQPath(..) => {
66-
match dm.borrow().get(&pat.id).map(|d| d.full_def()) {
68+
match dm.get(&pat.id).map(|d| d.full_def()) {
6769
Some(DefConst(..)) | Some(DefAssociatedConst(..)) => true,
6870
_ => false
6971
}
@@ -77,7 +79,7 @@ pub fn pat_is_const(dm: &DefMap, pat: &hir::Pat) -> bool {
7779
pub fn pat_is_resolved_const(dm: &DefMap, pat: &hir::Pat) -> bool {
7880
match pat.node {
7981
hir::PatIdent(_, _, None) | hir::PatEnum(..) | hir::PatQPath(..) => {
80-
match dm.borrow().get(&pat.id)
82+
match dm.get(&pat.id)
8183
.and_then(|d| if d.depth == 0 { Some(d.base_def) }
8284
else { None } ) {
8385
Some(DefConst(..)) | Some(DefAssociatedConst(..)) => true,
@@ -108,12 +110,12 @@ pub fn pat_is_binding_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
108110

109111
/// Call `it` on every "binding" in a pattern, e.g., on `a` in
110112
/// `match foo() { Some(a) => (), None => () }`
111-
pub fn pat_bindings<I>(dm: &DefMap, pat: &hir::Pat, mut it: I) where
113+
pub fn pat_bindings<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
112114
I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned<ast::Name>),
113115
{
114116
walk_pat(pat, |p| {
115117
match p.node {
116-
hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(dm, p) => {
118+
hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(&dm.borrow(), p) => {
117119
it(binding_mode, p.id, p.span, &respan(pth.span, pth.node.name));
118120
}
119121
_ => {}
@@ -122,12 +124,12 @@ pub fn pat_bindings<I>(dm: &DefMap, pat: &hir::Pat, mut it: I) where
122124
});
123125
}
124126

125-
pub fn pat_bindings_hygienic<I>(dm: &DefMap, pat: &hir::Pat, mut it: I) where
127+
pub fn pat_bindings_hygienic<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
126128
I: FnMut(hir::BindingMode, ast::NodeId, Span, &Spanned<ast::Ident>),
127129
{
128130
walk_pat(pat, |p| {
129131
match p.node {
130-
hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(dm, p) => {
132+
hir::PatIdent(binding_mode, ref pth, _) if pat_is_binding(&dm.borrow(), p) => {
131133
it(binding_mode, p.id, p.span, &respan(pth.span, pth.node));
132134
}
133135
_ => {}
@@ -153,7 +155,7 @@ pub fn pat_contains_bindings(dm: &DefMap, pat: &hir::Pat) -> bool {
153155

154156
/// Checks if the pattern contains any `ref` or `ref mut` bindings,
155157
/// and if yes wether its containing mutable ones or just immutables ones.
156-
pub fn pat_contains_ref_binding(dm: &DefMap, pat: &hir::Pat) -> Option<hir::Mutability> {
158+
pub fn pat_contains_ref_binding(dm: &RefCell<DefMap>, pat: &hir::Pat) -> Option<hir::Mutability> {
157159
let mut result = None;
158160
pat_bindings(dm, pat, |mode, _, _, _| {
159161
match mode {
@@ -172,7 +174,7 @@ pub fn pat_contains_ref_binding(dm: &DefMap, pat: &hir::Pat) -> Option<hir::Muta
172174

173175
/// Checks if the patterns for this arm contain any `ref` or `ref mut`
174176
/// bindings, and if yes wether its containing mutable ones or just immutables ones.
175-
pub fn arm_contains_ref_binding(dm: &DefMap, arm: &hir::Arm) -> Option<hir::Mutability> {
177+
pub fn arm_contains_ref_binding(dm: &RefCell<DefMap>, arm: &hir::Arm) -> Option<hir::Mutability> {
176178
arm.pats.iter()
177179
.filter_map(|pat| pat_contains_ref_binding(dm, pat))
178180
.max_by(|m| match *m {
@@ -226,7 +228,7 @@ pub fn necessary_variants(dm: &DefMap, pat: &hir::Pat) -> Vec<DefId> {
226228
hir::PatEnum(_, _) |
227229
hir::PatIdent(_, _, None) |
228230
hir::PatStruct(..) => {
229-
match dm.borrow().get(&p.id) {
231+
match dm.get(&p.id) {
230232
Some(&PathResolution { base_def: DefVariant(_, id, _), .. }) => {
231233
variants.push(id);
232234
}

src/librustc/middle/resolve_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
205205
hir::TyPath(None, ref path) => {
206206
// if this path references a trait, then this will resolve to
207207
// a trait ref, which introduces a binding scope.
208-
match self.def_map.borrow().get(&ty.id).map(|d| (d.base_def, d.depth)) {
208+
match self.def_map.get(&ty.id).map(|d| (d.base_def, d.depth)) {
209209
Some((def::DefTrait(..), 0)) => {
210210
self.with(LateScope(&Vec::new(), self.scope), |_, this| {
211211
this.visit_path(path, ty.id);

src/librustc/middle/ty/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub struct ctxt<'tcx> {
228228
pub types: CommonTypes<'tcx>,
229229

230230
pub sess: &'tcx Session,
231-
pub def_map: DefMap,
231+
pub def_map: RefCell<DefMap>,
232232

233233
pub named_region_map: resolve_lifetime::NamedRegionMap,
234234

@@ -453,7 +453,7 @@ impl<'tcx> ctxt<'tcx> {
453453
/// reference to the context, to allow formatting values that need it.
454454
pub fn create_and_enter<F, R>(s: &'tcx Session,
455455
arenas: &'tcx CtxtArenas<'tcx>,
456-
def_map: DefMap,
456+
def_map: RefCell<DefMap>,
457457
named_region_map: resolve_lifetime::NamedRegionMap,
458458
map: ast_map::Map<'tcx>,
459459
freevars: FreevarMap,

src/librustc_driver/driver.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
700700
syntax::ext::mtwt::clear_tables();
701701
}
702702

703-
let named_region_map = time(time_passes, "lifetime resolution",
704-
|| middle::resolve_lifetime::krate(sess, krate, &def_map));
703+
let named_region_map = time(time_passes, "lifetime resolution", ||
704+
middle::resolve_lifetime::krate(sess, krate, &def_map.borrow()));
705705

706706
time(time_passes, "looking for entry point",
707707
|| middle::entry::find_entry_point(sess, &ast_map));
@@ -718,7 +718,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
718718
middle::check_loop::check_crate(sess, krate));
719719

720720
time(time_passes, "static item recursion checking", ||
721-
middle::check_static_recursion::check_crate(sess, krate, &def_map, &ast_map));
721+
middle::check_static_recursion::check_crate(sess, krate, &def_map.borrow(), &ast_map));
722722

723723
ty::ctxt::create_and_enter(sess,
724724
arenas,

src/librustc_driver/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn test_env<F>(source_string: &str,
134134
let lang_items = lang_items::collect_language_items(&sess, &ast_map);
135135
let resolve::CrateMap { def_map, freevars, .. } =
136136
resolve::resolve_crate(&sess, &ast_map, resolve::MakeGlobMap::No);
137-
let named_region_map = resolve_lifetime::krate(&sess, krate, &def_map);
137+
let named_region_map = resolve_lifetime::krate(&sess, krate, &def_map.borrow());
138138
let region_map = region::resolve_crate(&sess, krate);
139139
ty::ctxt::create_and_enter(&sess,
140140
&arenas,

src/librustc_mir/hair/cx/pattern.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'tcx> Mirror<'tcx> for PatNode<'tcx> {
155155
},
156156

157157
hir::PatEnum(..) | hir::PatIdent(..) | hir::PatQPath(..)
158-
if pat_is_resolved_const(&cx.tcx.def_map, self.pat) =>
158+
if pat_is_resolved_const(&cx.tcx.def_map.borrow(), self.pat) =>
159159
{
160160
let def = cx.tcx.def_map.borrow().get(&self.pat.id).unwrap().full_def();
161161
match def {
@@ -231,7 +231,7 @@ impl<'tcx> Mirror<'tcx> for PatNode<'tcx> {
231231
}
232232

233233
hir::PatIdent(bm, ref ident, ref sub)
234-
if pat_is_binding(&cx.tcx.def_map, self.pat) =>
234+
if pat_is_binding(&cx.tcx.def_map.borrow(), self.pat) =>
235235
{
236236
let id = match self.binding_map {
237237
None => self.pat.id,

src/librustc_resolve/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ pub struct Resolver<'a, 'tcx:'a> {
11501150
// The idents for the primitive types.
11511151
primitive_type_table: PrimitiveTypeTable,
11521152

1153-
def_map: DefMap,
1153+
def_map: RefCell<DefMap>,
11541154
freevars: FreevarMap,
11551155
freevars_seen: NodeMap<NodeMap<usize>>,
11561156
export_map: ExportMap,
@@ -4026,7 +4026,7 @@ fn module_to_string(module: &Module) -> String {
40264026

40274027

40284028
pub struct CrateMap {
4029-
pub def_map: DefMap,
4029+
pub def_map: RefCell<DefMap>,
40304030
pub freevars: FreevarMap,
40314031
pub export_map: ExportMap,
40324032
pub trait_map: TraitMap,

src/librustc_trans/trans/_match.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ use util::nodemap::FnvHashMap;
222222
use util::ppaux;
223223

224224
use std;
225+
use std::cell::RefCell;
225226
use std::cmp::Ordering;
226227
use std::fmt;
227228
use std::rc::Rc;
@@ -495,7 +496,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
495496
}
496497

497498
fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
498-
dm: &DefMap,
499+
dm: &RefCell<DefMap>,
499500
m: &[Match<'a, 'p, 'blk, 'tcx>],
500501
col: usize,
501502
val: MatchInput,
@@ -516,7 +517,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
516517
let mut bound_ptrs = br.bound_ptrs.clone();
517518
match this.node {
518519
hir::PatIdent(_, ref path, None) => {
519-
if pat_is_binding(dm, &*this) {
520+
if pat_is_binding(&dm.borrow(), &*this) {
520521
bound_ptrs.push((path.node.name, val.val));
521522
}
522523
}
@@ -541,7 +542,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
541542
}
542543

543544
fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
544-
dm: &DefMap,
545+
dm: &RefCell<DefMap>,
545546
m: &[Match<'a, 'p, 'blk, 'tcx>],
546547
col: usize,
547548
val: MatchInput)
@@ -555,7 +556,7 @@ fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
555556

556557
// Collect all of the matches that can match against anything.
557558
enter_match(bcx, dm, m, col, val, |pats| {
558-
if pat_is_binding_or_wild(dm, &*pats[col]) {
559+
if pat_is_binding_or_wild(&dm.borrow(), &*pats[col]) {
559560
let mut r = pats[..col].to_vec();
560561
r.push_all(&pats[col + 1..]);
561562
Some(r)
@@ -596,7 +597,7 @@ fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
596597
fn enter_opt<'a, 'p, 'blk, 'tcx>(
597598
bcx: Block<'blk, 'tcx>,
598599
_: ast::NodeId,
599-
dm: &DefMap,
600+
dm: &RefCell<DefMap>,
600601
m: &[Match<'a, 'p, 'blk, 'tcx>],
601602
opt: &Opt,
602603
col: usize,
@@ -842,11 +843,11 @@ impl FailureHandler {
842843
}
843844
}
844845

845-
fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<usize> {
846-
fn pat_score(def_map: &DefMap, pat: &hir::Pat) -> usize {
846+
fn pick_column_to_specialize(def_map: &RefCell<DefMap>, m: &[Match]) -> Option<usize> {
847+
fn pat_score(def_map: &RefCell<DefMap>, pat: &hir::Pat) -> usize {
847848
match pat.node {
848849
hir::PatIdent(_, _, Some(ref inner)) => pat_score(def_map, &**inner),
849-
_ if pat_is_refutable(def_map, pat) => 1,
850+
_ if pat_is_refutable(&def_map.borrow(), pat) => 1,
850851
_ => 0
851852
}
852853
}
@@ -1800,7 +1801,7 @@ pub fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
18001801
let ccx = bcx.ccx();
18011802
match pat.node {
18021803
hir::PatIdent(pat_binding_mode, ref path1, ref inner) => {
1803-
if pat_is_binding(&tcx.def_map, &*pat) {
1804+
if pat_is_binding(&tcx.def_map.borrow(), &*pat) {
18041805
// Allocate the stack slot where the value of this
18051806
// binding will live and place it into the appropriate
18061807
// map.

src/librustc_trans/trans/debuginfo/create_scope_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn walk_pattern(cx: &CrateContext,
167167

168168
// Check if this is a binding. If so we need to put it on the
169169
// scope stack and maybe introduce an artificial scope
170-
if pat_util::pat_is_binding(def_map, &*pat) {
170+
if pat_util::pat_is_binding(&def_map.borrow(), &*pat) {
171171

172172
let name = path1.node.name;
173173

0 commit comments

Comments
 (0)