]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/hair/constant.rs
Rollup merge of #61499 - varkor:issue-53457, r=oli-obk
[rust.git] / src / librustc_mir / hair / constant.rs
index 0f5c696f7f9f3bc2a819cc77e4e9121bc350bd9f..a5be55d16d488b7049ce0c5239d2804988b3db99 100644 (file)
     let lit = match *lit {
         LitKind::Str(ref s, _) => {
             let s = s.as_str();
-            let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes(), ());
+            let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes());
             let allocation = tcx.intern_const_alloc(allocation);
             ConstValue::Slice { data: allocation, start: 0, end: s.len() }
         },
         LitKind::Err(ref s) => {
             let s = s.as_str();
-            let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes(), ());
+            let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes());
             let allocation = tcx.intern_const_alloc(allocation);
             return Ok(tcx.mk_const(ty::Const {
                 val: ConstValue::Slice{ data: allocation, start: 0, end: s.len() },
@@ -101,6 +101,5 @@ fn parse_float<'tcx>(
         }
     };
 
-    // We trust that `data` is properly truncated.
-    Ok(ConstValue::Scalar(Scalar::Raw { data, size }))
+    Ok(ConstValue::Scalar(Scalar::from_uint(data, Size::from_bytes(size))))
 }