about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-10 16:26:11 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-04-10 16:32:31 +0200
commitafb7acff57cf301f6229eb9a07060d694ed2b3ed (patch)
tree7924eb8b5da058201b70a38a4b62e0884017f8cb /src/libsyntax
parentc44d40e77f4dabbfff95a715006523b73918a7c4 (diff)
downloadrust-afb7acff57cf301f6229eb9a07060d694ed2b3ed.tar.gz
rust-afb7acff57cf301f6229eb9a07060d694ed2b3ed.zip
Re-add a fixme after some investigation into what's going on.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index c3478266db2..de77baa0ef2 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -1181,6 +1181,17 @@ impl<'a> MethodDef<'a> {
                     rules: ast::UnsafeBlock(ast::CompilerGenerated),
                     span: sp }));
 
+                // FIXME: This unconditionally casts to `isize`. However:
+                //
+                // 1. On 32-bit platforms, that will truncate 64-bit enums
+                //    that are making use of the upper 32 bits, and
+                //
+                // 2. On all platforms, it will misinterpret the sign bit
+                //    of a 64-bit enum.
+                //
+                // What it should do is lookup whether the enum has an
+                // repr-attribute and cast to that if necessary. But
+                // attributes are not yet available to this function.
                 let target_ty = cx.ty_ident(sp, cx.ident_of("isize"));
                 let variant_disr = cx.expr_cast(sp, variant_value, target_ty);
                 let let_stmt = cx.stmt_let(sp, false, ident, variant_disr);