Skip to content

Commit 9946e46

Browse files
committed
Export tag discriminants even for single-variant tags
I don't know exactly what's going on but this optimization is giving me problems with the check-fast runner. I also don't see how it is correct for external tags.
1 parent c047cfb commit 9946e46

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5873,10 +5873,8 @@ fn trans_constant(ccx: @crate_ctxt, it: &@ast::item, pt: &[str],
58735873
{|buf|
58745874
llvm::LLVMAddGlobal(ccx.llmod, T_int(), buf)
58755875
});
5876-
if n_variants != 1u {
5877-
llvm::LLVMSetInitializer(discrim_gvar, C_int(i as int));
5878-
llvm::LLVMSetGlobalConstant(discrim_gvar, True);
5879-
}
5876+
llvm::LLVMSetInitializer(discrim_gvar, C_int(i as int));
5877+
llvm::LLVMSetGlobalConstant(discrim_gvar, True);
58805878
ccx.discrims.insert(variant.node.id, discrim_gvar);
58815879
ccx.discrim_symbols.insert(variant.node.id, s);
58825880
i += 1u;

0 commit comments

Comments
 (0)