about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-07-24 10:19:20 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-07-29 14:08:15 +0000
commit75bdbf25e39f073b35eadedcf575affac7762a86 (patch)
treedda912558bb387a3f3462b05fff7a3d1872b6cd5 /compiler/rustc_middle/src
parent45b0c8d03e627d55f814a4cd03b90c5068664ac8 (diff)
downloadrust-75bdbf25e39f073b35eadedcf575affac7762a86.tar.gz
rust-75bdbf25e39f073b35eadedcf575affac7762a86.zip
Pick the largest niche even if the largest niche is wrapped around
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index a5123576fc6..aed94f9aa04 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -107,8 +107,8 @@ impl abi::Integer {
             abi::Integer::I8
         };
 
-        // If there are no negative values, we can use the unsigned fit.
-        if min >= 0 {
+        // Pick the smallest fit.
+        if unsigned_fit <= signed_fit {
             (cmp::max(unsigned_fit, at_least), false)
         } else {
             (cmp::max(signed_fit, at_least), true)