From 57dd22baad83d3e5a8ec81a0bf64ad54464988bc Mon Sep 17 00:00:00 2001 From: Samrat Man Singh Date: Tue, 28 Apr 2020 21:27:14 +0530 Subject: [PATCH] Suggest `into` to convert into `isize` only if uint is of width 8 Since Into is not implemented for uint of width greater than 8 --- src/librustc_typeck/check/demand.rs | 6 +++--- 1 file 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