diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-15 17:18:45 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-15 17:46:09 -0700 |
| commit | b38092e9a2b5965ab8b8e73580e4d39ed701330a (patch) | |
| tree | 483e5380eb4ab35f7463d5dea1e2a29ffcfe6bd1 /src/rustc | |
| parent | bbc46d527d70ac0bcab6c2b0763f059efc27a142 (diff) | |
In ty::normalize_ty, don't replace self_regions with None
Instead, replace with re_static. This was causing ty::subst to fail when called from trans::type_of::type_of. Already discussed with nmatsakis and it's a small change, so no review. Closes #3447
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/middle/ty.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 84510c7161e..90527e88bc8 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1473,7 +1473,10 @@ fn subst(cx: ctxt, fold_regions_and_ty( cx, typ, |r| match r { - re_bound(br_self) => substs.self_r.get(), + re_bound(br_self) => substs.self_r.expect( + #fmt("ty::subst: \ + Reference to self region when given substs with no \ + self region, ty = %s", ty_to_str(cx, typ))), _ => r }, |t| do_subst(cx, substs, t), @@ -3910,9 +3913,11 @@ fn normalize_ty(cx: ctxt, t: t) -> t { ty_enum(did, r) => match r.self_r { Some(_) => - // This enum has a self region. Get rid of it + // Use re_static since trans doesn't care about regions mk_enum(cx, did, - {self_r: None, self_ty: None, tps: r.tps}), + {self_r: Some(ty::re_static), + self_ty: None, + tps: r.tps}), None => t }, @@ -3921,7 +3926,8 @@ fn normalize_ty(cx: ctxt, t: t) -> t { match r.self_r { Some(_) => // Ditto. - mk_class(cx, did, {self_r: None, self_ty: None, tps: r.tps}), + mk_class(cx, did, {self_r: Some(ty::re_static), self_ty: None, + tps: r.tps}), None => t }, |
