From 9d59d33515d889f6e65f50226ba83d91a36bba0e Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 1 Mar 2011 16:49:05 -0800 Subject: [PATCH] rustc: Add in the size of the discriminant to generic_size_of() for tags --- src/comp/middle/trans.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index ed61fdd7e1e..0aaf582d024 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -909,7 +909,9 @@ fn dynamic_size_of(@block_ctxt cx, @ty.t t) -> result { bcx.build.Store(umax(bcx, this_size, old_max_size), max_size); } - ret res(bcx, bcx.build.Load(max_size)); + auto max_size_val = bcx.build.Load(max_size); + auto total_size = bcx.build.Add(max_size_val, llsize_of(T_int())); + ret res(bcx, total_size); } } }