diff options
| author | Ralf Jung <post@ralfj.de> | 2019-06-09 13:53:44 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-06-09 13:53:44 +0200 |
| commit | 8dfc8db235e205c60b56e0753996399a6f66f3e1 (patch) | |
| tree | d8c5ed57b40a65c5963fd0159c8c9e24f57a2da3 | |
| parent | 2ad303eb07e51ce0c4f9dd6a253ab4e938ab65f0 (diff) | |
| download | rust-8dfc8db235e205c60b56e0753996399a6f66f3e1.tar.gz rust-8dfc8db235e205c60b56e0753996399a6f66f3e1.zip | |
forgot about multivariant enum casts
| -rw-r--r-- | src/librustc_mir/interpret/cast.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 7a0c98bc44c..6392e0996ae 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -139,12 +139,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> // Floating point Float(FloatTy::F32) => self.cast_from_float(val.to_f32()?, dest_layout.ty), Float(FloatTy::F64) => self.cast_from_float(val.to_f64()?, dest_layout.ty), - // Integer(-like), including fn ptr casts + // Integer(-like), including fn ptr casts and casts from enums that + // are represented as integers (this excludes univariant enums, which + // are handled in `cast` directly). _ => { assert!( - src_layout.ty.is_bool() || src_layout.ty.is_char() || - src_layout.ty.is_integral() || src_layout.ty.is_region_ptr() || - src_layout.ty.is_unsafe_ptr() || src_layout.ty.is_fn_ptr(), + src_layout.ty.is_bool() || src_layout.ty.is_char() || + src_layout.ty.is_enum() || src_layout.ty.is_integral() || + src_layout.ty.is_unsafe_ptr() || src_layout.ty.is_fn_ptr() || + src_layout.ty.is_region_ptr(), "Unexpected cast from type {:?}", src_layout.ty ); match val.to_bits_or_ptr(src_layout.size, self) { |
