Skip to content

Commit 85970d4

Browse files
committed
Intern Region in tcx.
This makes sty only 32 bytes on machines with 64-bit pointers.
1 parent add6bb2 commit 85970d4

File tree

20 files changed

+93
-71
lines changed

20 files changed

+93
-71
lines changed

src/librustc/metadata/tydecode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
432432
'&' => {
433433
let r = parse_region(st, |x,y| conv(x,y));
434434
let mt = parse_mt(st, |x,y| conv(x,y));
435-
return ty::mk_rptr(st.tcx, r, mt);
435+
return ty::mk_rptr(st.tcx, st.tcx.mk_region(r), mt);
436436
}
437437
'V' => {
438438
let t = parse_ty(st, |x,y| conv(x,y));
@@ -500,7 +500,8 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
500500
let region = parse_region(st, |x,y| conv(x,y));
501501
let substs = parse_substs(st, |x,y| conv(x,y));
502502
assert_eq!(next(st), ']');
503-
return ty::mk_unboxed_closure(st.tcx, did, region, st.tcx.mk_substs(substs));
503+
return ty::mk_unboxed_closure(st.tcx, did,
504+
st.tcx.mk_region(region), st.tcx.mk_substs(substs));
504505
}
505506
'e' => {
506507
return ty::mk_err();

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
861861
};
862862
let bk = ty::BorrowKind::from_mutbl(m);
863863
self.delegate.borrow(expr.id, expr.span, cmt,
864-
r, bk, AutoRef);
864+
*r, bk, AutoRef);
865865
}
866866
}
867867
}

src/librustc/middle/infer/coercion.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
230230
};
231231

232232
let a_borrowed = ty::mk_rptr(self.tcx(),
233-
r_borrow,
233+
self.tcx().mk_region(r_borrow),
234234
mt {ty: inner_ty, mutbl: mutbl_b});
235235
try!(sub.tys(a_borrowed, b));
236236

@@ -271,7 +271,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
271271
let coercion = Coercion(self.get_ref().trace.clone());
272272
let r_borrow = self.get_ref().infcx.next_region_var(coercion);
273273
let ty = ty::mk_rptr(self.tcx(),
274-
r_borrow,
274+
self.tcx().mk_region(r_borrow),
275275
ty::mt{ty: ty, mutbl: mt_b.mutbl});
276276
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
277277
debug!("Success, coerced with AutoDerefRef(1, \
@@ -424,7 +424,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
424424
let r_a = self.get_ref().infcx.next_region_var(coercion);
425425

426426
self.coerce_object(a, b, b_mutbl,
427-
|tr| ty::mk_rptr(tcx, r_a, ty::mt{ mutbl: b_mutbl, ty: tr }),
427+
|tr| ty::mk_rptr(tcx, tcx.mk_region(r_a),
428+
ty::mt{ mutbl: b_mutbl, ty: tr }),
428429
|| AutoPtr(r_a, b_mutbl, None))
429430
}
430431

src/librustc/middle/infer/combine.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
499499
// All ty_unboxed_closure types with the same id represent
500500
// the (anonymous) type of the same closure expression. So
501501
// all of their regions should be equated.
502-
let region = try!(this.equate().regions(a_region, b_region));
502+
let region = try!(this.equate().regions(*a_region, *b_region));
503503
let substs = try!(this.substs_variances(None, a_substs, b_substs));
504-
Ok(ty::mk_unboxed_closure(tcx, a_id, region, tcx.mk_substs(substs)))
504+
Ok(ty::mk_unboxed_closure(tcx, a_id, tcx.mk_region(region), tcx.mk_substs(substs)))
505505
}
506506

507507
(&ty::ty_uniq(a_inner), &ty::ty_uniq(b_inner)) => {
@@ -515,7 +515,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
515515
}
516516

517517
(&ty::ty_rptr(a_r, ref a_mt), &ty::ty_rptr(b_r, ref b_mt)) => {
518-
let r = try!(this.contraregions(a_r, b_r));
518+
let r = try!(this.contraregions(*a_r, *b_r));
519519
// FIXME(14985) If we have mutable references to trait objects, we
520520
// used to use covariant subtyping. I have preserved this behaviour,
521521
// even though it is probably incorrect. So don't go down the usual
@@ -527,7 +527,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
527527
}
528528
_ => try!(this.mts(a_mt, b_mt))
529529
};
530-
Ok(ty::mk_rptr(tcx, r, mt))
530+
Ok(ty::mk_rptr(tcx, tcx.mk_region(r), mt))
531531
}
532532

533533
(&ty::ty_vec(a_t, Some(sz_a)), &ty::ty_vec(b_t, Some(sz_b))) => {

src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pub fn opt_deref_kind(t: Ty) -> Option<deref_kind> {
204204

205205
ty::ty_rptr(r, mt) => {
206206
let kind = ty::BorrowKind::from_mutbl(mt.mutbl);
207-
Some(deref_ptr(BorrowedPtr(kind, r)))
207+
Some(deref_ptr(BorrowedPtr(kind, *r)))
208208
}
209209

210210
ty::ty_closure(box ty::ClosureTy {
@@ -1071,7 +1071,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
10711071
-> (ast::Mutability, ty::Region) {
10721072
match slice_ty.sty {
10731073
ty::ty_rptr(r, ref mt) => match mt.ty.sty {
1074-
ty::ty_vec(_, None) => (mt.mutbl, r),
1074+
ty::ty_vec(_, None) => (mt.mutbl, *r),
10751075
_ => vec_slice_info(tcx, pat, mt.ty),
10761076
},
10771077

src/librustc/middle/ty.rs

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
410410
},
411411
&AutoPtr(r, m, Some(box ref autoref)) => {
412412
match type_of_autoref(cx, autoref) {
413-
Some(ty) => Some(mk_rptr(cx, r, mt {mutbl: m, ty: ty})),
413+
Some(ty) => Some(mk_rptr(cx, cx.mk_region(r), mt {mutbl: m, ty: ty})),
414414
None => None
415415
}
416416
}
@@ -609,6 +609,7 @@ pub struct CtxtArenas<'tcx> {
609609
type_: TypedArena<TyS<'tcx>>,
610610
substs: TypedArena<Substs<'tcx>>,
611611
bare_fn: TypedArena<BareFnTy<'tcx>>,
612+
region: TypedArena<Region>,
612613
}
613614

614615
impl<'tcx> CtxtArenas<'tcx> {
@@ -617,6 +618,7 @@ impl<'tcx> CtxtArenas<'tcx> {
617618
type_: TypedArena::new(),
618619
substs: TypedArena::new(),
619620
bare_fn: TypedArena::new(),
621+
region: TypedArena::new(),
620622
}
621623
}
622624
}
@@ -636,6 +638,7 @@ pub struct ctxt<'tcx> {
636638
// FIXME as above, use a hashset if equivalent elements can be queried.
637639
substs_interner: RefCell<FnvHashMap<&'tcx Substs<'tcx>, &'tcx Substs<'tcx>>>,
638640
bare_fn_interner: RefCell<FnvHashMap<&'tcx BareFnTy<'tcx>, &'tcx BareFnTy<'tcx>>>,
641+
region_interner: RefCell<FnvHashMap<&'tcx Region, &'tcx Region>>,
639642

640643
pub sess: Session,
641644
pub def_map: DefMap,
@@ -1340,7 +1343,7 @@ pub enum sty<'tcx> {
13401343
ty_str,
13411344
ty_vec(Ty<'tcx>, Option<uint>), // Second field is length.
13421345
ty_ptr(mt<'tcx>),
1343-
ty_rptr(Region, mt<'tcx>),
1346+
ty_rptr(&'tcx Region, mt<'tcx>),
13441347

13451348
// If the def-id is Some(_), then this is the type of a specific
13461349
// fn item. Otherwise, if None(_), it a fn pointer type.
@@ -1350,7 +1353,7 @@ pub enum sty<'tcx> {
13501353
ty_trait(Box<TyTrait<'tcx>>),
13511354
ty_struct(DefId, &'tcx Substs<'tcx>),
13521355

1353-
ty_unboxed_closure(DefId, Region, &'tcx Substs<'tcx>),
1356+
ty_unboxed_closure(DefId, &'tcx Region, &'tcx Substs<'tcx>),
13541357

13551358
ty_tup(Vec<Ty<'tcx>>),
13561359

@@ -2085,6 +2088,7 @@ pub fn mk_ctxt<'tcx>(s: Session,
20852088
interner: RefCell::new(FnvHashMap::new()),
20862089
substs_interner: RefCell::new(FnvHashMap::new()),
20872090
bare_fn_interner: RefCell::new(FnvHashMap::new()),
2091+
region_interner: RefCell::new(FnvHashMap::new()),
20882092
named_region_map: named_region_map,
20892093
item_variance_map: RefCell::new(DefIdMap::new()),
20902094
variance_computed: Cell::new(false),
@@ -2164,6 +2168,16 @@ impl<'tcx> ctxt<'tcx> {
21642168
self.bare_fn_interner.borrow_mut().insert(bare_fn, bare_fn);
21652169
bare_fn
21662170
}
2171+
2172+
pub fn mk_region(&self, region: Region) -> &'tcx Region {
2173+
if let Some(region) = self.region_interner.borrow().get(&region) {
2174+
return *region;
2175+
}
2176+
2177+
let region = self.arenas.region.alloc(region);
2178+
self.region_interner.borrow_mut().insert(region, region);
2179+
region
2180+
}
21672181
}
21682182

21692183
// Interns a type/name combination, stores the resulting box in cx.interner,
@@ -2269,7 +2283,7 @@ impl FlagComputation {
22692283
}
22702284
}
22712285

2272-
&ty_unboxed_closure(_, ref region, substs) => {
2286+
&ty_unboxed_closure(_, region, substs) => {
22732287
self.add_region(*region);
22742288
self.add_substs(substs);
22752289
}
@@ -2299,7 +2313,7 @@ impl FlagComputation {
22992313
}
23002314

23012315
&ty_rptr(r, ref m) => {
2302-
self.add_region(r);
2316+
self.add_region(*r);
23032317
self.add_ty(m.ty);
23042318
}
23052319

@@ -2404,7 +2418,7 @@ pub fn mk_str<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
24042418
mk_t(cx, ty_str)
24052419
}
24062420

2407-
pub fn mk_str_slice<'tcx>(cx: &ctxt<'tcx>, r: Region, m: ast::Mutability) -> Ty<'tcx> {
2421+
pub fn mk_str_slice<'tcx>(cx: &ctxt<'tcx>, r: &'tcx Region, m: ast::Mutability) -> Ty<'tcx> {
24082422
mk_rptr(cx, r,
24092423
mt {
24102424
ty: mk_t(cx, ty_str),
@@ -2421,14 +2435,14 @@ pub fn mk_uniq<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { mk_t(cx, ty_un
24212435

24222436
pub fn mk_ptr<'tcx>(cx: &ctxt<'tcx>, tm: mt<'tcx>) -> Ty<'tcx> { mk_t(cx, ty_ptr(tm)) }
24232437

2424-
pub fn mk_rptr<'tcx>(cx: &ctxt<'tcx>, r: Region, tm: mt<'tcx>) -> Ty<'tcx> {
2438+
pub fn mk_rptr<'tcx>(cx: &ctxt<'tcx>, r: &'tcx Region, tm: mt<'tcx>) -> Ty<'tcx> {
24252439
mk_t(cx, ty_rptr(r, tm))
24262440
}
24272441

2428-
pub fn mk_mut_rptr<'tcx>(cx: &ctxt<'tcx>, r: Region, ty: Ty<'tcx>) -> Ty<'tcx> {
2442+
pub fn mk_mut_rptr<'tcx>(cx: &ctxt<'tcx>, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx> {
24292443
mk_rptr(cx, r, mt {ty: ty, mutbl: ast::MutMutable})
24302444
}
2431-
pub fn mk_imm_rptr<'tcx>(cx: &ctxt<'tcx>, r: Region, ty: Ty<'tcx>) -> Ty<'tcx> {
2445+
pub fn mk_imm_rptr<'tcx>(cx: &ctxt<'tcx>, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx> {
24322446
mk_rptr(cx, r, mt {ty: ty, mutbl: ast::MutImmutable})
24332447
}
24342448

@@ -2448,7 +2462,7 @@ pub fn mk_vec<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, sz: Option<uint>) -> Ty<'tcx>
24482462
mk_t(cx, ty_vec(ty, sz))
24492463
}
24502464

2451-
pub fn mk_slice<'tcx>(cx: &ctxt<'tcx>, r: Region, tm: mt<'tcx>) -> Ty<'tcx> {
2465+
pub fn mk_slice<'tcx>(cx: &ctxt<'tcx>, r: &'tcx Region, tm: mt<'tcx>) -> Ty<'tcx> {
24522466
mk_rptr(cx, r,
24532467
mt {
24542468
ty: mk_vec(cx, tm.ty, None),
@@ -2512,7 +2526,7 @@ pub fn mk_struct<'tcx>(cx: &ctxt<'tcx>, struct_id: ast::DefId,
25122526
}
25132527

25142528
pub fn mk_unboxed_closure<'tcx>(cx: &ctxt<'tcx>, closure_id: ast::DefId,
2515-
region: Region, substs: &'tcx Substs<'tcx>)
2529+
region: &'tcx Region, substs: &'tcx Substs<'tcx>)
25162530
-> Ty<'tcx> {
25172531
mk_t(cx, ty_unboxed_closure(closure_id, region, substs))
25182532
}
@@ -3087,9 +3101,10 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
30873101

30883102
ty_rptr(r, ref mt) => {
30893103
TC::ReachesFfiUnsafe | match mt.ty.sty {
3090-
ty_str => borrowed_contents(r, ast::MutImmutable),
3091-
ty_vec(..) => tc_ty(cx, mt.ty, cache).reference(borrowed_contents(r, mt.mutbl)),
3092-
_ => tc_ty(cx, mt.ty, cache).reference(borrowed_contents(r, mt.mutbl)),
3104+
ty_str => borrowed_contents(*r, ast::MutImmutable),
3105+
ty_vec(..) => tc_ty(cx, mt.ty, cache).reference(borrowed_contents(*r,
3106+
mt.mutbl)),
3107+
_ => tc_ty(cx, mt.ty, cache).reference(borrowed_contents(*r, mt.mutbl)),
30933108
}
30943109
}
30953110

@@ -3124,7 +3139,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
31243139
let upvars = unboxed_closure_upvars(cx, did, substs);
31253140
TypeContents::union(upvars.as_slice(),
31263141
|f| tc_ty(cx, f.ty, cache))
3127-
| borrowed_contents(r, MutMutable)
3142+
| borrowed_contents(*r, MutMutable)
31283143
}
31293144

31303145
ty_tup(ref tys) => {
@@ -3796,7 +3811,7 @@ pub fn deref<'tcx>(ty: Ty<'tcx>, explicit: bool) -> Option<mt<'tcx>> {
37963811

37973812
pub fn close_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
37983813
match ty.sty {
3799-
ty_open(ty) => mk_rptr(cx, ReStatic, mt {ty: ty, mutbl:ast::MutImmutable}),
3814+
ty_open(ty) => mk_rptr(cx, cx.mk_region(ReStatic), mt {ty: ty, mutbl:ast::MutImmutable}),
38003815
_ => cx.sess.bug(format!("Trying to close a non-open type {}",
38013816
ty_to_string(cx, ty))[])
38023817
}
@@ -4000,7 +4015,7 @@ pub fn ty_region(tcx: &ctxt,
40004015
span: Span,
40014016
ty: Ty) -> Region {
40024017
match ty.sty {
4003-
ty_rptr(r, _) => r,
4018+
ty_rptr(r, _) => *r,
40044019
ref s => {
40054020
tcx.sess.span_bug(
40064021
span,
@@ -4206,7 +4221,7 @@ pub fn adjust_ty_for_autoref<'tcx>(cx: &ctxt<'tcx>,
42064221
&Some(box ref a) => adjust_ty_for_autoref(cx, span, ty, Some(a)),
42074222
&None => ty
42084223
};
4209-
mk_rptr(cx, r, mt {
4224+
mk_rptr(cx, cx.mk_region(r), mt {
42104225
ty: adjusted_ty,
42114226
mutbl: m
42124227
})
@@ -5494,7 +5509,7 @@ pub fn unboxed_closure_upvars<'tcx>(tcx: &ctxt<'tcx>, closure_id: ast::DefId, su
54945509
var_id: freevar_def_id.node,
54955510
closure_expr_id: closure_id.node
54965511
}].clone();
5497-
freevar_ty = mk_rptr(tcx, borrow.region, ty::mt {
5512+
freevar_ty = mk_rptr(tcx, tcx.mk_region(borrow.region), ty::mt {
54985513
ty: freevar_ty,
54995514
mutbl: borrow.kind.to_mutbl_lossy()
55005515
});
@@ -6348,7 +6363,7 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
63486363
walk_ty(ty, |ty| {
63496364
match ty.sty {
63506365
ty_rptr(region, _) => {
6351-
accumulator.push(region)
6366+
accumulator.push(*region)
63526367
}
63536368
ty_trait(ref t) => {
63546369
accumulator.push_all(t.principal.substs().regions().as_slice());
@@ -6363,7 +6378,7 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
63636378
UniqTraitStore => {}
63646379
}
63656380
}
6366-
ty_unboxed_closure(_, ref region, substs) => {
6381+
ty_unboxed_closure(_, region, substs) => {
63676382
accumulator.push(*region);
63686383
accum_substs(accumulator, substs);
63696384
}

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
401401
}, ty_to_string(cx, tm.ty))
402402
}
403403
ty_rptr(r, ref tm) => {
404-
let mut buf = region_ptr_to_string(cx, r);
404+
let mut buf = region_ptr_to_string(cx, *r);
405405
buf.push_str(mt_to_string(cx, tm)[]);
406406
buf
407407
}

src/librustc_trans/trans/_match.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ fn bind_subslice_pat(bcx: Block,
635635
let slice_len_offset = C_uint(bcx.ccx(), offset_left + offset_right);
636636
let slice_len = Sub(bcx, len, slice_len_offset);
637637
let slice_ty = ty::mk_slice(bcx.tcx(),
638-
ty::ReStatic,
638+
bcx.tcx().mk_region(ty::ReStatic),
639639
ty::mt {ty: vt.unit_ty, mutbl: ast::MutImmutable});
640640
let scratch = rvalue_scratch_datum(bcx, slice_ty, "");
641641
Store(bcx, slice_begin,
@@ -808,7 +808,9 @@ fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
808808
ty::ty_uint(ast::TyU8) => {
809809
// NOTE: cast &[u8] to &str and abuse the str_eq lang item,
810810
// which calls memcmp().
811-
let t = ty::mk_str_slice(cx.tcx(), ty::ReStatic, ast::MutImmutable);
811+
let t = ty::mk_str_slice(cx.tcx(),
812+
cx.tcx().mk_region(ty::ReStatic),
813+
ast::MutImmutable);
812814
let lhs = BitCast(cx, lhs, type_of::type_of(cx.ccx(), t).ptr_to());
813815
let rhs = BitCast(cx, rhs, type_of::type_of(cx.ccx(), t).ptr_to());
814816
compare_str(cx, lhs, rhs, rhs_t)

src/librustc_trans/trans/base.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ pub fn self_type_for_unboxed_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
264264
let unboxed_closure = &(*unboxed_closures)[closure_id];
265265
match unboxed_closure.kind {
266266
ty::FnUnboxedClosureKind => {
267-
ty::mk_imm_rptr(ccx.tcx(), ty::ReStatic, fn_ty)
267+
ty::mk_imm_rptr(ccx.tcx(), ccx.tcx().mk_region(ty::ReStatic), fn_ty)
268268
}
269269
ty::FnMutUnboxedClosureKind => {
270-
ty::mk_mut_rptr(ccx.tcx(), ty::ReStatic, fn_ty)
270+
ty::mk_mut_rptr(ccx.tcx(), ccx.tcx().mk_region(ty::ReStatic), fn_ty)
271271
}
272272
ty::FnOnceUnboxedClosureKind => fn_ty
273273
}
@@ -2599,14 +2599,14 @@ pub fn get_fn_llvm_attributes<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty<
25992599
attrs.arg(idx, llvm::ReadOnlyAttribute);
26002600
}
26012601

2602-
if let ReLateBound(_, BrAnon(_)) = b {
2602+
if let ReLateBound(_, BrAnon(_)) = *b {
26032603
attrs.arg(idx, llvm::NoCaptureAttribute);
26042604
}
26052605
}
26062606

26072607
// When a reference in an argument has no named lifetime, it's impossible for that
26082608
// reference to escape this function (returned or stored beyond the call by a closure).
2609-
ty::ty_rptr(ReLateBound(_, BrAnon(_)), mt) => {
2609+
ty::ty_rptr(&ReLateBound(_, BrAnon(_)), mt) => {
26102610
let llsz = llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
26112611
attrs.arg(idx, llvm::NoCaptureAttribute)
26122612
.arg(idx, llvm::DereferenceableAttribute(llsz));

src/librustc_trans/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ fn auto_ref<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
21302130
// Compute final type. Note that we are loose with the region and
21312131
// mutability, since those things don't matter in trans.
21322132
let referent_ty = lv_datum.ty;
2133-
let ptr_ty = ty::mk_imm_rptr(bcx.tcx(), ty::ReStatic, referent_ty);
2133+
let ptr_ty = ty::mk_imm_rptr(bcx.tcx(), bcx.tcx().mk_region(ty::ReStatic), referent_ty);
21342134

21352135
// Get the pointer.
21362136
let llref = lv_datum.to_llref();

0 commit comments

Comments
 (0)