Skip to content

Commit f810075

Browse files
committed
---
yaml --- r: 42047 b: refs/heads/master c: e6cadc4 h: refs/heads/master i: 42045: 59ebf8d 42043: 7abaee2 42039: 6eab8eb 42031: 1973828 42015: f73c706 41983: 3f927ed v: v3
1 parent 41e58cd commit f810075

File tree

3 files changed

+9
-46
lines changed

3 files changed

+9
-46
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2b67d88809d9f6ddc4686ee514cb78200db1d737
2+
refs/heads/master: e6cadc4c036a08173c7cc2645c6f4bdb171b3b1c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/librustc/middle/typeck/check/method.rs

Lines changed: 6 additions & 24 deletions
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(

trunk/src/librustc/middle/typeck/infer/coercion.rs

Lines changed: 2 additions & 21 deletions
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)