void-packages/srcpkgs/rust/patches/0013-round-result-of-highest-as-f64-.log-2.0.patch
q66 2cab55965b rust: update to 1.43.1, switch to llvm10
Also remove option static_llvm and add option bindist, which
helps simplify building bootstrap tarballs.
2020-05-24 21:55:49 +02:00

29 lines
1.1 KiB
Diff

From d74af8923022dd369315ada0a06e467dffd127cf Mon Sep 17 00:00:00 2001
From: Michael Hudson-Doyle <michael.hudson@canonical.com>
Date: Wed, 13 Mar 2019 15:55:30 +1300
Subject: [PATCH 13/15] round result of (highest as f64).log(2.0)
Even though (1024f64).log(2.0) has an exact, representable, value, with
rustc 1.32 on i386 it comes out as +9.999999999999999985 with
optimization enabled. And the rustc doesn't like having two defintions
for U1024 etc.
---
vendor/typenum/build/main.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vendor/typenum/build/main.rs b/vendor/typenum/build/main.rs
index 9c9f237c..153031a2 100644
--- a/vendor/typenum/build/main.rs
+++ b/vendor/typenum/build/main.rs
@@ -77,7 +77,7 @@ pub fn no_std() {}
fn main() {
let highest: u64 = 1024;
- let first2: u32 = (highest as f64).log(2.0) as u32 + 1;
+ let first2: u32 = (highest as f64).log(2.0).round() as u32 + 1;
let first10: u32 = (highest as f64).log(10.0) as u32 + 1;
let uints = (0..(highest + 1))
.chain((first2..64).map(|i| 2u64.pow(i)))
--
2.26.2