Skip to content

Commit e6cadc4

Browse files
committedJan 28, 2013
remove hacks now that #3148 is fixed
r=brson
1 parent 2b67d88 commit e6cadc4

File tree

2 files changed

+8
-45
lines changed

2 files changed

+8
-45
lines changed
 

Diff for: ‎src/librustc/middle/typeck/check/method.rs

+6-24
Original file line numberDiff line numberDiff line change
@@ -739,18 +739,20 @@ impl LookupContext {
739739

740740
let tcx = self.tcx();
741741
return match ty::get(self_ty).sty {
742-
ty::ty_rptr(self_r, self_mt) if self_mt.mutbl == m_mutbl => {
743-
let region = fresh_region(self, self_r);
742+
ty::ty_rptr(_, self_mt) if self_mt.mutbl == m_mutbl => {
743+
let region = self.infcx().next_region_var(self.expr.span,
744+
self.expr.id);
744745
(ty::mk_rptr(tcx, region, self_mt),
745746
ty::AutoAdjustment {
746747
autoderefs: autoderefs+1,
747748
autoref: Some(ty::AutoRef {kind: AutoPtr,
748749
region: region,
749750
mutbl: self_mt.mutbl})})
750751
}
751-
ty::ty_evec(self_mt, vstore_slice(self_r))
752+
ty::ty_evec(self_mt, vstore_slice(_))
752753
if self_mt.mutbl == m_mutbl => {
753-
let region = fresh_region(self, self_r);
754+
let region = self.infcx().next_region_var(self.expr.span,
755+
self.expr.id);
754756
(ty::mk_evec(tcx, self_mt, vstore_slice(region)),
755757
ty::AutoAdjustment {
756758
autoderefs: autoderefs,
@@ -763,26 +765,6 @@ impl LookupContext {
763765
autoref: None})
764766
}
765767
};
766-
767-
fn fresh_region(self: &LookupContext,
768-
self_r: ty::Region) -> ty::Region {
769-
let region = self.infcx().next_region_var(self.expr.span,
770-
self.expr.id);
771-
772-
// FIXME(#3148)---in principle this dependency should
773-
// be done more generally as part of regionck
774-
match infer::mk_subr(self.infcx(), true, self.expr.span,
775-
region, self_r) {
776-
Ok(_) => {}
777-
Err(e) => {
778-
self.tcx().sess.span_bug(
779-
self.expr.span,
780-
fmt!("Failed with error: %?", e));
781-
}
782-
}
783-
784-
return region;
785-
}
786768
}
787769

788770
fn search_for_autosliced_method(

Diff for: ‎src/librustc/middle/typeck/infer/coercion.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,7 @@ impl Coerce {
196196
let inner_ty = match *sty_a {
197197
ty::ty_box(mt_a) => mt_a.ty,
198198
ty::ty_uniq(mt_a) => mt_a.ty,
199-
ty::ty_rptr(r_a, mt_a) => {
200-
// Ensure that the pointer we are borrowing from lives
201-
// at least as long as the borrowed result.
202-
//
203-
// FIXME(#3148)---in principle this dependency should
204-
// be done more generally
205-
if_ok!(sub.contraregions(r_a, r_borrow));
206-
mt_a.ty
207-
}
199+
ty::ty_rptr(r_a, mt_a) => mt_a.ty,
208200
_ => {
209201
return self.subtype(a, b);
210202
}
@@ -267,18 +259,7 @@ impl Coerce {
267259
let sub = Sub(**self);
268260
let r_borrow = self.infcx.next_region_var_nb(self.span);
269261
let ty_inner = match *sty_a {
270-
ty::ty_evec(mt, vstore_box) => mt.ty,
271-
ty::ty_evec(mt, vstore_uniq) => mt.ty,
272-
ty::ty_evec(mt, vstore_fixed(_)) => mt.ty,
273-
ty::ty_evec(mt, vstore_slice(r_a)) => {
274-
// Ensure that the pointer we are borrowing from lives
275-
// at least as long as the borrowed result.
276-
//
277-
// FIXME(#3148)---in principle this dependency should
278-
// be done more generally
279-
if_ok!(sub.contraregions(r_a, r_borrow));
280-
mt.ty
281-
}
262+
ty::ty_evec(mt, _) => mt.ty,
282263
_ => {
283264
return self.subtype(a, b);
284265
}

0 commit comments

Comments
 (0)
Please sign in to comment.