about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamrat Man Singh <samratmansingh@gmail.com>2020-04-28 21:27:14 +0530
committerSamrat Man Singh <samratmansingh@gmail.com>2020-04-28 21:40:03 +0530
commit57dd22baad83d3e5a8ec81a0bf64ad54464988bc (patch)
treea97d448ef43325e837e8f647866a09c42e158d92
parent1f0a864570d79807c7843ebb995fdcdd384ff3c9 (diff)
downloadrust-57dd22baad83d3e5a8ec81a0bf64ad54464988bc.tar.gz
rust-57dd22baad83d3e5a8ec81a0bf64ad54464988bc.zip
Suggest `into` to convert into `isize` only if uint is of width 8
Since Into<isize> is not implemented for uint of width greater than 8
-rw-r--r--src/librustc_typeck/check/demand.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 980aefa710f..aa36bec6e1e 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -770,12 +770,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 (&ty::Int(exp), &ty::Uint(found)) => {
                     let is_fallible = match (exp.bit_width(), found.bit_width()) {
                         (Some(exp), Some(found)) if found < exp => false,
-                        (None, Some(found)) if found <= 16 => false,
-                        _ => true
+                        (None, Some(8)) => false,
+                        _ => true,
                     };
                     suggest_to_change_suffix_or_into(err, is_fallible);
                     true
-                },
+                }
                 (&ty::Uint(_), &ty::Int(_)) => {
                     suggest_to_change_suffix_or_into(err, true);
                     true