Skip to content

Commit 06a1d30

Browse files
---
yaml --- r: 143051 b: refs/heads/try2 c: 7af2e6e h: refs/heads/master i: 143049: 058fa89 143047: 2784165 v: v3
1 parent 7f3a415 commit 06a1d30

File tree

3 files changed

+68
-10
lines changed

3 files changed

+68
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e0108a47abcd1977670aa2ca0e5e88321cf789bf
8+
refs/heads/try2: 7af2e6ee451ffa9baacfc3eb04d45f7b3cee295d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,15 +1137,7 @@ fn get_or_create_type_metadata(cx: &mut CrateContext,
11371137
create_enum_metadata(cx, t, def_id, substs, span)
11381138
},
11391139
ty::ty_box(ref mt) => {
1140-
let content_llvm_type = type_of::type_of(cx, mt.ty);
1141-
let content_type_metadata = get_or_create_type_metadata(cx, mt.ty, span);
1142-
1143-
let box_metadata = create_boxed_type_metadata(cx,
1144-
content_llvm_type,
1145-
content_type_metadata,
1146-
span);
1147-
1148-
create_pointer_type_metadata(cx, t, box_metadata)
1140+
create_pointer_to_box_metadata(cx, t, mt.ty)
11491141
},
11501142
ty::ty_evec(ref mt, ref vstore) => {
11511143
match *vstore {
@@ -1162,6 +1154,9 @@ fn get_or_create_type_metadata(cx: &mut CrateContext,
11621154
}
11631155
}
11641156
},
1157+
ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
1158+
create_pointer_to_box_metadata(cx, t, mt.ty)
1159+
},
11651160
ty::ty_uniq(ref mt) |
11661161
ty::ty_ptr(ref mt) |
11671162
ty::ty_rptr(_, ref mt) => {
@@ -1193,6 +1188,24 @@ fn get_or_create_type_metadata(cx: &mut CrateContext,
11931188

11941189
dbg_cx(cx).created_types.insert(type_id, type_metadata);
11951190
return type_metadata;
1191+
1192+
1193+
fn create_pointer_to_box_metadata(cx: &mut CrateContext,
1194+
pointer_type: ty::t,
1195+
type_in_box: ty::t)
1196+
-> DIType {
1197+
let content_llvm_type = type_of::type_of(cx, type_in_box);
1198+
let content_type_metadata = get_or_create_type_metadata(cx,
1199+
type_in_box,
1200+
codemap::dummy_sp());
1201+
1202+
let box_metadata = create_boxed_type_metadata(cx,
1203+
content_llvm_type,
1204+
content_type_metadata,
1205+
codemap::dummy_sp());
1206+
1207+
create_pointer_type_metadata(cx, pointer_type, box_metadata)
1208+
}
11961209
}
11971210

11981211
fn set_debug_location(cx: @mut CrateContext, scope: DIScope, line: uint, col: uint) {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:-Z extra-debug-info
12+
// debugger:set print pretty off
13+
// debugger:break zzz
14+
// debugger:run
15+
// debugger:finish
16+
17+
// debugger:print *ordinary_unique
18+
// check:$1 = {-1, -2}
19+
20+
// debugger:print managed_within_unique.val->x
21+
// check:$2 = -3
22+
23+
// debugger:print managed_within_unique.val->y->val
24+
// check:$3 = -4
25+
26+
struct ContainsManaged
27+
{
28+
x: int,
29+
y: @int
30+
}
31+
32+
fn main() {
33+
34+
let ordinary_unique = ~(-1, -2);
35+
36+
37+
// This is a special case: Normally values allocated in the exchange heap are not boxed, unless,
38+
// however, if they contain managed pointers.
39+
// This test case verifies that both cases are handled correctly.
40+
let managed_within_unique = ~ContainsManaged { x: -3, y: @-4 };
41+
42+
zzz();
43+
}
44+
45+
fn zzz() {()}

0 commit comments

Comments
 (0)