File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 33use crate :: hir;
44use crate :: hir:: def_id:: DefId ;
55use crate :: infer:: canonical:: Canonical ;
6- use crate :: mir:: interpret:: ConstValue ;
6+ use crate :: mir:: interpret:: { ConstValue , truncate } ;
77use crate :: middle:: region;
88use polonius_engine:: Atom ;
99use rustc_data_structures:: indexed_vec:: Idx ;
@@ -2118,8 +2118,7 @@ impl<'tcx> Const<'tcx> {
21182118 let size = tcx. layout_of ( ty) . unwrap_or_else ( |e| {
21192119 panic ! ( "could not compute layout for {:?}: {:?}" , ty, e)
21202120 } ) . size ;
2121- let shift = 128 - size. bits ( ) ;
2122- let truncated = ( bits << shift) >> shift;
2121+ let truncated = truncate ( bits, size) ;
21232122 assert_eq ! ( truncated, bits, "from_bits called with untruncated value" ) ;
21242123 Self :: from_scalar ( Scalar :: Bits { bits, size : size. bytes ( ) as u8 } , ty. value )
21252124 }
You can’t perform that action at this time.
0 commit comments