Skip to content

Commit 03e5e8a

Browse files
Ariel Ben-Yehudaarielb1
authored andcommitted
---
yaml --- r: 233675 b: refs/heads/beta c: fc30438 h: refs/heads/master i: 233673: d7c573b 233671: 8e7f7fc v: v3
1 parent c9f0f52 commit 03e5e8a

File tree

18 files changed

+562
-541
lines changed

18 files changed

+562
-541
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 2bcc6d8ec7f525328a1e8c8ce423ac3ac015eb6d
26+
refs/heads/beta: fc304384e6ed40f505fa0f04043044dd44e73118
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/metadata/tydecode.rs

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
207207
}
208208
'B' => {
209209
assert_eq!(self.next(), '[');
210+
// this is totally wrong, but nobody relevant cares about
211+
// this field - it will die soon(TM).
210212
let node_id = self.parse_uint() as ast::NodeId;
211213
assert_eq!(self.next(), '|');
212214
let space = self.parse_param_space();
@@ -246,24 +248,26 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
246248
}
247249

248250
fn parse_scope(&mut self) -> region::CodeExtent {
249-
match self.next() {
251+
self.tcx.region_maps.bogus_code_extent(match self.next() {
252+
// the scopes created here are totally bogus with their
253+
// NodeIDs
250254
'P' => {
251255
assert_eq!(self.next(), '[');
252256
let fn_id = self.parse_uint() as ast::NodeId;
253257
assert_eq!(self.next(), '|');
254258
let body_id = self.parse_uint() as ast::NodeId;
255259
assert_eq!(self.next(), ']');
256-
region::CodeExtent::ParameterScope {
260+
region::CodeExtentData::ParameterScope {
257261
fn_id: fn_id, body_id: body_id
258262
}
259263
}
260264
'M' => {
261265
let node_id = self.parse_uint() as ast::NodeId;
262-
region::CodeExtent::Misc(node_id)
266+
region::CodeExtentData::Misc(node_id)
263267
}
264268
'D' => {
265269
let node_id = self.parse_uint() as ast::NodeId;
266-
region::CodeExtent::DestructionScope(node_id)
270+
region::CodeExtentData::DestructionScope(node_id)
267271
}
268272
'B' => {
269273
assert_eq!(self.next(), '[');
@@ -274,10 +278,10 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
274278
let block_remainder = region::BlockRemainder {
275279
block: node_id, first_statement_index: first_stmt_index,
276280
};
277-
region::CodeExtent::Remainder(block_remainder)
281+
region::CodeExtentData::Remainder(block_remainder)
278282
}
279283
_ => panic!("parse_scope: bad input")
280-
}
284+
})
281285
}
282286

283287
fn parse_destruction_scope_data(&mut self) -> region::DestructionScopeData {
@@ -619,6 +623,33 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
619623
}
620624
}
621625

626+
pub fn parse_region_param_def(&mut self) -> ty::RegionParameterDef {
627+
let name = self.parse_name(':');
628+
let def_id = self.parse_def(NominalType);
629+
let space = self.parse_param_space();
630+
assert_eq!(self.next(), '|');
631+
let index = self.parse_u32();
632+
assert_eq!(self.next(), '|');
633+
let mut bounds = vec![];
634+
loop {
635+
match self.next() {
636+
'R' => bounds.push(self.parse_region()),
637+
'.' => { break; }
638+
c => {
639+
panic!("parse_region_param_def: bad bounds ('{}')", c)
640+
}
641+
}
642+
}
643+
ty::RegionParameterDef {
644+
name: name,
645+
def_id: def_id,
646+
space: space,
647+
index: index,
648+
bounds: bounds
649+
}
650+
}
651+
652+
622653
fn parse_object_lifetime_default(&mut self) -> ty::ObjectLifetimeDefault {
623654
match self.next() {
624655
'a' => ty::ObjectLifetimeDefault::Ambiguous,

branches/beta/src/librustc/metadata/tyencode.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,14 @@ pub fn enc_region(w: &mut Encoder, cx: &ctxt, r: ty::Region) {
278278
}
279279
}
280280

281-
fn enc_scope(w: &mut Encoder, _cx: &ctxt, scope: region::CodeExtent) {
282-
match scope {
283-
region::CodeExtent::ParameterScope {
281+
fn enc_scope(w: &mut Encoder, cx: &ctxt, scope: region::CodeExtent) {
282+
match cx.tcx.region_maps.code_extent_data(scope) {
283+
region::CodeExtentData::ParameterScope {
284284
fn_id, body_id } => mywrite!(w, "P[{}|{}]", fn_id, body_id),
285-
region::CodeExtent::Misc(node_id) => mywrite!(w, "M{}", node_id),
286-
region::CodeExtent::Remainder(region::BlockRemainder {
285+
region::CodeExtentData::Misc(node_id) => mywrite!(w, "M{}", node_id),
286+
region::CodeExtentData::Remainder(region::BlockRemainder {
287287
block: b, first_statement_index: i }) => mywrite!(w, "B[{}|{}]", b, i),
288-
region::CodeExtent::DestructionScope(node_id) => mywrite!(w, "D{}", node_id),
288+
region::CodeExtentData::DestructionScope(node_id) => mywrite!(w, "D{}", node_id),
289289
}
290290
}
291291

@@ -396,17 +396,6 @@ pub fn enc_existential_bounds<'a,'tcx>(w: &mut Encoder,
396396
mywrite!(w, ".");
397397
}
398398

399-
pub fn enc_region_bounds<'a, 'tcx>(w: &mut Encoder,
400-
cx: &ctxt<'a, 'tcx>,
401-
rs: &[ty::Region]) {
402-
for &r in rs {
403-
mywrite!(w, "R");
404-
enc_region(w, cx, r);
405-
}
406-
407-
mywrite!(w, ".");
408-
}
409-
410399
pub fn enc_type_param_def<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>,
411400
v: &ty::TypeParameterDef<'tcx>) {
412401
mywrite!(w, "{}:{}|{}|{}|{}|",
@@ -416,6 +405,18 @@ pub fn enc_type_param_def<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>,
416405
enc_object_lifetime_default(w, cx, v.object_lifetime_default);
417406
}
418407

408+
pub fn enc_region_param_def(w: &mut Encoder, cx: &ctxt,
409+
v: &ty::RegionParameterDef) {
410+
mywrite!(w, "{}:{}|{}|{}|",
411+
v.name, (cx.ds)(v.def_id),
412+
v.space.to_uint(), v.index);
413+
for &r in &v.bounds {
414+
mywrite!(w, "R");
415+
enc_region(w, cx, r);
416+
}
417+
mywrite!(w, ".");
418+
}
419+
419420
fn enc_object_lifetime_default<'a, 'tcx>(w: &mut Encoder,
420421
cx: &ctxt<'a, 'tcx>,
421422
default: ty::ObjectLifetimeDefault)

0 commit comments

Comments
 (0)