File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/libsyntax/ext/deriving/generic Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1181,6 +1181,17 @@ impl<'a> MethodDef<'a> {
11811181 rules : ast:: UnsafeBlock ( ast:: CompilerGenerated ) ,
11821182 span : sp } ) ) ;
11831183
1184+ // FIXME: This unconditionally casts to `isize`. However:
1185+ //
1186+ // 1. On 32-bit platforms, that will truncate 64-bit enums
1187+ // that are making use of the upper 32 bits, and
1188+ //
1189+ // 2. On all platforms, it will misinterpret the sign bit
1190+ // of a 64-bit enum.
1191+ //
1192+ // What it should do is lookup whether the enum has an
1193+ // repr-attribute and cast to that if necessary. But
1194+ // attributes are not yet available to this function.
11841195 let target_ty = cx. ty_ident ( sp, cx. ident_of ( "isize" ) ) ;
11851196 let variant_disr = cx. expr_cast ( sp, variant_value, target_ty) ;
11861197 let let_stmt = cx. stmt_let ( sp, false , ident, variant_disr) ;
You can’t perform that action at this time.
0 commit comments