diff options
| author | Yashhwanth Ram <ryr397@gmail.com> | 2020-04-10 18:37:44 +0530 |
|---|---|---|
| committer | Yashhwanth Ram <ryr397@gmail.com> | 2020-04-10 18:59:06 +0530 |
| commit | b3c9912dbad13d7a3c369df4913e36d7fd7315ad (patch) | |
| tree | d2a295b5dc0a81be728461fff115bfb7293ddeb7 | |
| parent | 39b62533c7f9d0581a6ea9b9fc2cc51f21c3b5b0 (diff) | |
| download | rust-b3c9912dbad13d7a3c369df4913e36d7fd7315ad.tar.gz rust-b3c9912dbad13d7a3c369df4913e36d7fd7315ad.zip | |
Suggest x.into() when it is a better choice than x.try_into() when
converting ints in librustc_typeck Fixes #70851
| -rw-r--r-- | src/librustc_typeck/check/demand.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 369bb183bcd..7ef4bfb0141 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -755,6 +755,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (&ty::Int(ref exp), &ty::Int(ref found)) => { let is_fallible = match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found > exp => true, + (None, Some(8 | 16)) | (Some(8 | 16), None) => false, (None, _) | (_, None) => true, _ => false, }; @@ -764,6 +765,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (&ty::Uint(ref exp), &ty::Uint(ref found)) => { let is_fallible = match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found > exp => true, + (None, Some(8 | 16)) | (Some(8 | 16), None) => false, (None, _) | (_, None) => true, _ => false, }; |
