Skip to content

Commit 0cd72d2

Browse files
committed
rustc: Autoderef through region pointers
1 parent 45d0b5f commit 0cd72d2

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,6 +1849,10 @@ fn autoderef(cx: block, v: ValueRef, t: ty::t) -> result_t {
18491849
t1 = derefed.t;
18501850
v1 = derefed.v;
18511851
}
1852+
ty::ty_rptr(_, mt) {
1853+
t1 = mt.ty;
1854+
v1 = v;
1855+
}
18521856
ty::ty_res(did, inner, tps) {
18531857
t1 = ty::substitute_type_params(ccx.tcx, tps, inner);
18541858
v1 = GEPi(cx, v1, [0, 1]);

src/rustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ fn type_autoderef(cx: ctxt, t: t) -> t {
11191119
let t1 = t;
11201120
loop {
11211121
alt get(t1).struct {
1122-
ty_box(mt) | ty_uniq(mt) { t1 = mt.ty; }
1122+
ty_box(mt) | ty_uniq(mt) | ty::ty_rptr(_, mt) { t1 = mt.ty; }
11231123
ty_res(_, inner, tps) {
11241124
t1 = substitute_type_params(cx, tps, inner);
11251125
}

src/rustc/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
10581058
let t1 = t;
10591059
loop {
10601060
alt structure_of(fcx, sp, t1) {
1061-
ty::ty_box(inner) | ty::ty_uniq(inner) {
1061+
ty::ty_box(inner) | ty::ty_uniq(inner) | ty::ty_rptr(_, inner) {
10621062
alt ty::get(t1).struct {
10631063
ty::ty_var(v1) {
10641064
ty::occurs_check(fcx.ccx.tcx, sp, v1,

0 commit comments

Comments
 (0)