rustc: Autoderef through region pointers
This commit is contained in:
parent
45d0b5f0b9
commit
0cd72d24dc
3 changed files with 6 additions and 2 deletions
|
|
@ -1849,6 +1849,10 @@ fn autoderef(cx: block, v: ValueRef, t: ty::t) -> result_t {
|
|||
t1 = derefed.t;
|
||||
v1 = derefed.v;
|
||||
}
|
||||
ty::ty_rptr(_, mt) {
|
||||
t1 = mt.ty;
|
||||
v1 = v;
|
||||
}
|
||||
ty::ty_res(did, inner, tps) {
|
||||
t1 = ty::substitute_type_params(ccx.tcx, tps, inner);
|
||||
v1 = GEPi(cx, v1, [0, 1]);
|
||||
|
|
|
|||
|
|
@ -1119,7 +1119,7 @@ fn type_autoderef(cx: ctxt, t: t) -> t {
|
|||
let t1 = t;
|
||||
loop {
|
||||
alt get(t1).struct {
|
||||
ty_box(mt) | ty_uniq(mt) { t1 = mt.ty; }
|
||||
ty_box(mt) | ty_uniq(mt) | ty::ty_rptr(_, mt) { t1 = mt.ty; }
|
||||
ty_res(_, inner, tps) {
|
||||
t1 = substitute_type_params(cx, tps, inner);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1058,7 +1058,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
|
|||
let t1 = t;
|
||||
loop {
|
||||
alt structure_of(fcx, sp, t1) {
|
||||
ty::ty_box(inner) | ty::ty_uniq(inner) {
|
||||
ty::ty_box(inner) | ty::ty_uniq(inner) | ty::ty_rptr(_, inner) {
|
||||
alt ty::get(t1).struct {
|
||||
ty::ty_var(v1) {
|
||||
ty::occurs_check(fcx.ccx.tcx, sp, v1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue