Skip to content

Commit 3ac521d

Browse files
committed
Added quick fix to prevent zero-width constant expressions from being translated.
1 parent b072d2b commit 3ac521d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_trans/trans/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
151151
}
152152

153153
// If we see a const here, that's because it evaluates to a type with zero size. We
154-
// should be able to just discard it.
155-
// FIXME: Check the type of the expression and see if it's a zero-size type instead of
156-
// this hack.
154+
// should be able to just discard it, since const expressions are guaranteed not to
155+
// have side effects. This seems to be reached through tuple struct constructors being
156+
// passed zero-size constants.
157157
if let hir::ExprPath(..) = expr.node {
158158
match bcx.def(expr.id) {
159159
Def::Const(_) | Def::AssociatedConst(_) => {

0 commit comments

Comments
 (0)