Suggest x.into() when it is a better choice than x.try_into() when
converting ints in librustc_typeck Fixes #70851
This commit is contained in:
parent
39b62533c7
commit
b3c9912dba
1 changed files with 2 additions and 0 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue