Skip to content

Commit 7b938d8

Browse files
committed
rustc: Add region def ids to the AST
1 parent e2f6052 commit 7b938d8

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

src/rustc/metadata/astencode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ impl of tr for ast::def {
434434
ast::def_class_method(did0, did1) {
435435
ast::def_class_method(did0.tr(xcx), did1.tr(xcx))
436436
}
437+
ast::def_region(nid) { ast::def_region(xcx.tr_id(nid)) }
437438
}
438439
}
439440
}
@@ -1004,4 +1005,4 @@ fn test_simplification() {
10041005
}
10051006
_ { fail; }
10061007
}
1007-
}
1008+
}

src/rustc/metadata/astencode_gen.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8212,6 +8212,7 @@ fn serialize_164<S: std::serialization::serializer>(s: S,
82128212
/*syntax::ast::def_id*/
82138213
/*syntax::ast::def_id*//*syntax::ast::def_id*/
82148214
/*syntax::ast::def_id*//*syntax::ast::def_id*/
8215+
/*syntax::ast::node_id*/
82158216
{||
82168217
alt v {
82178218
syntax::ast::def_fn(v0, v1) {
@@ -8470,6 +8471,19 @@ fn serialize_164<S: std::serialization::serializer>(s: S,
84708471
}
84718472
})
84728473
}
8474+
syntax::ast::def_region(v0) {
8475+
s.emit_enum_variant("syntax::ast::def_region", 17u,
8476+
1u,
8477+
{||
8478+
{
8479+
s.emit_enum_variant_arg(0u,
8480+
{||
8481+
serialize_27(s,
8482+
v0)
8483+
})
8484+
}
8485+
})
8486+
}
84738487
}
84748488
});
84758489
}
@@ -8590,6 +8604,8 @@ fn deserialize_164<S: std::serialization::deserializer>(s: S) ->
85908604
/*syntax::ast::def_id*//*syntax::ast::def_id*/
85918605

85928606
/*syntax::ast::def_id*//*syntax::ast::def_id*/
8607+
8608+
/*syntax::ast::node_id*/
85938609
{||
85948610
s.read_enum_variant({|v_id|
85958611
alt check v_id {
@@ -8731,6 +8747,12 @@ fn deserialize_164<S: std::serialization::deserializer>(s: S) ->
87318747
deserialize_165(s)
87328748
}))
87338749
}
8750+
17u {
8751+
syntax::ast::def_region(s.read_enum_variant_arg(0u,
8752+
{||
8753+
deserialize_27(s)
8754+
}))
8755+
}
87348756
}
87358757
})
87368758
})

src/rustc/middle/resolve.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,7 @@ fn ns_for_def(d: def) -> namespace {
17131713
ast::def_ty(_) | ast::def_binding(_) | ast::def_use(_) |
17141714
ast::def_ty_param(_, _) | ast::def_prim_ty(_) | ast::def_class(_)
17151715
{ ns_type }
1716+
ast::def_region(_) { fail "regions are not handled by this pass" }
17161717
}
17171718
}
17181719

src/rustc/syntax/ast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ enum def {
5050
def_class_field(def_id, def_id),
5151
// No purity allowed for now, I guess
5252
// (simpler this way, b/c presumably methods read mutable state)
53-
def_class_method(def_id, def_id)
53+
def_class_method(def_id, def_id),
54+
def_region(node_id)
5455
}
5556

5657
// The set of meta_items that define the compilation environment of the crate,

src/rustc/syntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn def_id_of_def(d: def) -> def_id {
4242
def_class(id) | def_class_field(_, id) | def_class_method(_, id) { id }
4343

4444
def_arg(id, _) | def_local(id, _) | def_self(id) |
45-
def_upvar(id, _, _) | def_binding(id) {
45+
def_upvar(id, _, _) | def_binding(id) | def_region(id) {
4646
local_def(id)
4747
}
4848

0 commit comments

Comments
 (0)