Skip to content

Commit

Permalink
Re-add a fixme after some investigation into what's going on.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Apr 10, 2015
1 parent c44d40e commit afb7acf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libsyntax/ext/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit afb7acf

Please sign in to comment.